Created
February 24, 2021 14:22
-
-
Save prokash-sarkar/4e29d9c54eaed362d840d3c07e7a387b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@ExperimentalCoroutinesApi | |
class MainCoroutineRule : TestWatcher(), TestCoroutineScope by TestCoroutineScope() { | |
override fun starting(description: Description) { | |
super.starting(description) | |
Dispatchers.setMain(this.coroutineContext[ContinuationInterceptor] as CoroutineDispatcher) | |
} | |
override fun finished(description: Description) { | |
super.finished(description) | |
Dispatchers.resetMain() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment