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

viralshah

04/14/2020, 5:06 AM
Copy code
@Test
fun `should fetch JsonObject when call executes successfully`() = runBlockingTest {

    coEvery { webClient.get().uri(any<URI>()).awaitExchange().awaitBody<String>() } returns "{}"

    val result = service.fetchData(paramsMap, transactionId)
    assertThat(result).isNotNull
    assertThat(result).isInstanceOf(JsonObject::class.java)
}
Hi Guys, my test is hanging for some reason, could you help me figure out why?
r

rkeazor

04/14/2020, 6:09 AM
There is really no way to tell without looking at your code . Also does using coEvery require you to be inside a coroutine. you might want to ask for guidance in the #mockk channel
More than likely one of your coroutines isn't finishing
m

Martin Nordholts

04/14/2020, 10:47 AM
for starters, “unroll” all calls and add log prints to see how far you get
t

tseisel

04/14/2020, 6:12 PM
I don't think that's actually possible to mock such a long chain of calls with
mockK
...
7 Views