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

Saiedmomen

01/12/2019, 12:45 AM
Unbenannt.kt
a

Allan Wang

01/12/2019, 12:47 AM
I can’t see an immediate issue, but I don’t think you can close the dispatcher and reuse it in future tests. It may not be a problem for a single test
Another part is that it looks like you have no suspension related calls from your test. Your test may have finished (and dispatcher reset) before the launched methods are actually finished
s

Saiedmomen

01/12/2019, 12:50 AM
would it throw after the end of the test?
a

Allan Wang

01/12/2019, 12:50 AM
If you launch something without waiting, the test will finish immediately afterwards. You then reset the main dispatcher, so if your launched call then transitions into the main context, it will no longer be there
A quick test, though invalid, is to try removing the
@AfterEach
block. The correct fix is to wait for your request to complete
s

Saiedmomen

01/12/2019, 12:54 AM
no still getting same exception
s

streetsofboston

01/12/2019, 1:12 AM
Could you post the stacktrace of the exception you get? Might give some more info why/when the exception happens.
Also, is 'coVerify' blocking?
s

Saiedmomen

01/12/2019, 9:08 AM
@streetsofboston it is in the channel
no coVerify is a mockk facility for verifying suspend function behaviour
3 Views