Skip to content

Instantly share code, notes, and snippets.

@chao2zhang
Last active June 23, 2021 17:39
Show Gist options
  • Save chao2zhang/8fec0d8ebf301693d0630242fd96a164 to your computer and use it in GitHub Desktop.
Save chao2zhang/8fec0d8ebf301693d0630242fd96a164 to your computer and use it in GitHub Desktop.
FlowLiveDataConversionTest
class FlowLiveDataTest {
@Rule
@JvmField
val rule = InstantTaskExecutorRule()
private val testDispatcher = TestCoroutineDispatcher()
@Before
fun setup() {
Dispatchers.setMain(testDispatcher)
}
@After
fun cleanUp() {
Dispatchers.resetMain()
testDispatcher.cleanupTestCoroutines()
}
@Test
fun testDefaultTimeout() = testDispatcher.runBlockingTest {
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment