Helio
06/16/2022, 4:42 AMmockk
? During the migration our team noticed that some of our Integration tests were breaking because mockk
is no longer able to mock Ktor HttpClients.
Does anyone knows anything about that? I read through the Ktor migration guided but I could not find any behaviour change.
For example: The snippet below used to work with Ktor v1, but it is no longer working with Ktor v2.
myHttpClient = mockk<MyHttpClient>()
mockkObject(MyHttpClient)
coEvery { MyHttpClient.getClient() } returns myHttpClient
Any tip would be greatly appreciated.Sam
06/16/2022, 9:38 AMmockk
HttpClient
is one of those APIs where mockk
doesn't work well because there are just too many extension functions and plugin behaviours to worry aboutHelio
06/16/2022, 9:43 PMMyHttpClient.getClient()
get mocked, the tests were trying to accessing getClient()
.