https://kotlinlang.org logo
#coroutines
Title
# coroutines
s

Sam

12/19/2018, 9:51 PM
Does any one have unit test recommendation for testing coroutine launched from Android's ViewModel scope? I'm able to pass a Unconfined dispatcher from unit tests to work around the Main looper uninitialized case. However, mockito verify fails as expected call and actual call differs in continuation
s

streetsofboston

12/19/2018, 9:54 PM
Did you try using the
TestCoroutineContext
instead of the Unconfined one?
m

matt tighe

12/20/2018, 5:14 PM
Did you try writing your tests like this?
Copy code
@Test
fun test() = runBlocking { /* TEST */ }
4 Views