RxJava 2 overriding IO scheduler in unit test
问题 I'm trying to test the following RxKotlin/RxJava 2 code: validate(data) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .flatMap { ... } I'm attempting to override the schedulers as follows: // Runs before each test suite RxJavaPlugins.setInitIoSchedulerHandler { Schedulers.trampoline() } RxAndroidPlugins.setInitMainThreadSchedulerHandler { Schedulers.trampoline() } However, I get the following error when running the test: java.lang.ExceptionInInitializerError ...