You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be really nice to have ability to somehow swap defaultHttpClient: okhttp3.Call.Factory with Mock Entity in tests. For now current implementation of functions like httpGet {} can be only tested by using MockWebServer from okhttp or you have to inject okhttp3.Call.Factory manually.
Ideally i would like to have integration with mockk, because it's designated mocking framework for kotlin.
Example:
@EnableOkHttpMock
class MyTest {
private val sut = MyBestService()
fun `test foo is bar`() {
//given
every { httpGet(any()) } returns "foo" to "bar"
//when
val res = sut.getBar()
//then
assert("bar", res)
}
}
The text was updated successfully, but these errors were encountered:
It would be really nice to have ability to somehow swap defaultHttpClient: okhttp3.Call.Factory with Mock Entity in tests. For now current implementation of functions like httpGet {} can be only tested by using MockWebServer from okhttp or you have to inject okhttp3.Call.Factory manually.
Ideally i would like to have integration with mockk, because it's designated mocking framework for kotlin.
Example:
The text was updated successfully, but these errors were encountered: