nwh
03/14/2019, 6:49 PMOkHttpClient
declared as a single dependency, and the Retrofit API as another (which uses get()
for the client). I found a mock setup for OkHttp that uses an interceptor to return a custom response, but I can't figure out how to set it up with koin. How should I do it? When I use declareMock
I start getting errors in OkHttp..
When I copy an identical declaration from the declareMock
to single
in a non-test environment, everything works exactly as expected. It is only when using the declareMock
that there is a problem. Here's the difference in object creation order:
Mock:
----
Creating client (mock)
Created client (mock)
Creating API wrapper
Creating ProPublica API
Created ProPublica API
Created API wrapper
Real:
----
Creating API wrapper
Creating ProPublica API
Creating client (real)
Created client (real)
Created ProPublica API
Created API wrapper
arnaud.giuliani
03/15/2019, 7:52 AMarnaud.giuliani
03/15/2019, 7:52 AMmock
version of your OkHttp that returns mocked responsearnaud.giuliani
03/15/2019, 7:53 AMnwh
03/15/2019, 4:53 PMarnaud.giuliani
03/25/2019, 9:14 AM