I’m using Spring for my app and Ktor Client for al...
# ktor
j
I’m using Spring for my app and Ktor Client for all the requests I need to make. What’s the best way to mock these requests?
i
You can try to mock client instance with MockkBean https://github.com/Ninja-Squad/springmockk or you can mock the rest service with something like https://wiremock.org/
i
Do you want to mock the actual requests or the responses? If you don't want to test your spring app responses you can use the Ktor MockEngine.
and then you don't need to mock anything in your requests.
j
I’m using wiremock to mock the responses, but I figured out the problem is the requests are being made in different coroutines so it’s no mocking in correctly for some reason
i
unless wiremock provides something unique MockEngine cannot, I would recommend using
MockEngine