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

Christian Sousa

04/15/2020, 4:06 PM
Hello, I’m implementing some tests but right now I’ve hit a wall with the following:
Copy code
@Test
fun fetchAvailableStuff() {
    runBlockingTest {
        val job = launch(Dispatchers.Main) {
            api.fetchAvailableStuff { success ->
                println("----------- TEST -----------")
                println(success)
            }
        }
        job.join()
    }
}
But it gives me:
java.lang.IllegalStateException: This job has not completed yet
I already tried some of the solutions that are in this channel but with no luck
s

Saurabh

04/16/2020, 10:25 AM
I also ran into the same issue when using
runBlockingTest
although I never really solved it. But my tests run fine if I use
runBlocking
instead
4 Views