rx.android.plugins.RxAndroidSchedulersHook Java Examples
The following examples show how to use
rx.android.plugins.RxAndroidSchedulersHook.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SignInPresenterTest.java From Moxy with MIT License | 6 votes |
@Before public void setUp() { MockitoAnnotations.initMocks(this); presenter = new SignInPresenter(); presenter.setViewState(signInViewState); RxJavaPlugins.getInstance().reset(); RxJavaPlugins.getInstance().registerSchedulersHook(new RxJavaSchedulersHook() { @Override public Scheduler getIOScheduler() { return Schedulers.immediate(); } }); RxAndroidPlugins.getInstance().reset(); RxAndroidPlugins.getInstance().registerSchedulersHook(new RxAndroidSchedulersHook() { @Override public Scheduler getMainThreadScheduler() { return Schedulers.immediate(); } }); }
Example #2
Source File: RepositoriesPresenterTest.java From Moxy with MIT License | 6 votes |
@Before public void setUp() { MockitoAnnotations.initMocks(this); presenter = new RepositoriesPresenter(); presenter.setViewState(repositoriesViewState); RxJavaPlugins.getInstance().reset(); RxJavaPlugins.getInstance().registerSchedulersHook(new RxJavaSchedulersHook() { @Override public Scheduler getIOScheduler() { return Schedulers.immediate(); } }); RxAndroidPlugins.getInstance().reset(); RxAndroidPlugins.getInstance().registerSchedulersHook(new RxAndroidSchedulersHook() { @Override public Scheduler getMainThreadScheduler() { return Schedulers.immediate(); } }); }
Example #3
Source File: RxUnitTestTools.java From fingerpoetry-android with Apache License 2.0 | 6 votes |
/** * 把异步变成同步,方便测试 */ public static void openRxTools() { if (isInitRxTools) { return; } isInitRxTools = true; RxAndroidSchedulersHook rxAndroidSchedulersHook = new RxAndroidSchedulersHook() { @Override public Scheduler getMainThreadScheduler() { return Schedulers.immediate(); } }; RxJavaSchedulersHook rxJavaSchedulersHook = new RxJavaSchedulersHook() { @Override public Scheduler getIOScheduler() { return Schedulers.immediate(); } }; RxAndroidPlugins.getInstance().registerSchedulersHook(rxAndroidSchedulersHook); RxJavaPlugins.getInstance().registerSchedulersHook(rxJavaSchedulersHook); }
Example #4
Source File: RxUtils.java From AndroidSchool with Apache License 2.0 | 5 votes |
public static void setupTestSchedulers() { try { RxJavaHooks.setOnIOScheduler(scheduler -> Schedulers.immediate()); RxJavaHooks.setOnNewThreadScheduler(scheduler -> Schedulers.immediate()); RxAndroidPlugins.getInstance().registerSchedulersHook(new RxAndroidSchedulersHook() { @Override public Scheduler getMainThreadScheduler() { return Schedulers.immediate(); } }); } catch (IllegalStateException ignored) { } }
Example #5
Source File: RxJUnitRunner.java From AndroidSchool with Apache License 2.0 | 5 votes |
private void setupTestSchedulers() { RxJavaHooks.setOnIOScheduler(scheduler -> Schedulers.immediate()); RxJavaHooks.setOnNewThreadScheduler(scheduler -> Schedulers.immediate()); try { RxAndroidPlugins.getInstance().registerSchedulersHook(new RxAndroidSchedulersHook() { @Override public Scheduler getMainThreadScheduler() { return Schedulers.immediate(); } }); } catch (IllegalStateException ignored) { // already registered } }