Last active
December 27, 2021 08:35
-
-
Save cp-radhika-s/b8c7cc16fe9eaa51e608406c26462ecd to your computer and use it in GitHub Desktop.
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
@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