What is the recommanded way to test suspending fun...
# coroutines
t
What is the recommanded way to test suspending functions that are members of a class ? In the code below my test function is suspended indefinitely and the
assertThat
statement is never reached. Why ?
d
Does it make a difference if you return the deferred from
getFoo()
?
t
I added some detail to the code after some investigation with the debugger. My class under test is a coroutine-confined cache for the last received
Foo
from a
Flowable
. It seems that the
assertThat
statement is executed. But
runBlocking
prevents the test from finishing.
d
I generally avoid
runblocking{}