Created
November 12, 2017 18:22
-
-
Save Gerlac/63728ad96066958c200b4b4fcb0f9323 to your computer and use it in GitHub Desktop.
ComputationSchedulerTestRule implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ComputationSchedulerTestRule : TestRule { | |
val computationScheduler: TestScheduler = TestScheduler() | |
override fun apply(statement: Statement?, p1: Description?): Statement { | |
return object : Statement() { | |
@Throws(Throwable::class) | |
override fun evaluate() { | |
RxJavaPlugins.setComputationSchedulerHandler { computationScheduler } | |
statement!!.evaluate() | |
RxJavaPlugins.reset() | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment