https://kotlinlang.org logo
#mockk
Title
# mockk
m

Mendess

11/26/2021, 3:34 PM
hello 👋 I have really weird error and I don't know how to fix. Can someone help me understand it? I don't have a function that long
m

Matteo Mirk

11/29/2021, 8:39 AM
Mockk is telling you that the reported call on HttpClient has not been stubbed. Probably in your test you created a mock of HttpClient and your code is calling it, even indirectly. If this is the case and you don’t need or bother stubbing that call you can declare a relaxed mock to avoid this:
Copy code
val httpClient = mockk<HttpClient>(relaxed = true)
m

Mendess

11/29/2021, 8:41 AM
Yeah, I figured it out eventually. I can't mock extension methods, right?
m

Matteo Mirk

11/29/2021, 8:47 AM
2 Views