Last active
June 23, 2021 17:39
-
-
Save chao2zhang/8fec0d8ebf301693d0630242fd96a164 to your computer and use it in GitHub Desktop.
FlowLiveDataConversionTest
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 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