Paul Woitaschek
05/17/2019, 9:39 AMjava.lang.IllegalStateException: This job has not completed yet
?
kotlin
@Test
fun remoteConfigWorks() = runBlockingTest {
val remoteConfig = FirebaseRemoteConfig.getInstance()
val worked = suspendCoroutine<Boolean> { cont ->
remoteConfig.fetch().addOnCompleteListener {
if (it.isSuccessful) {
cont.resume(true)
} else {
cont.resumeWithException(it.exception ?: AssertionError("Fetching was not succssfull"))
}
}
}
assertThat(worked).isTrue()
}
elizarov
05/17/2019, 11:57 AMPaul Woitaschek
05/17/2019, 2:26 PMrunBlockingTest {
suspendCancellableCoroutine<Unit> { cont ->
thread {
Thread.sleep(1000)
cont.resume(Unit)
}
}
}
elizarov
05/17/2019, 2:44 PMPaul Woitaschek
05/17/2019, 2:59 PM