- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 40
 
Open
Description
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)
    }
}
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request