Questions tagged [mockwebserver]

A library for testing HTTP and HTTPS clients.

This library makes it possible to write fast, reliable unit tests for HTTP clients. Like object mocking frameworks, it allows you to script mock responses, exercise them, and then review the recorded requests.

Link: https://code.google.com/p/mockwebserver/

157 questions
0
votes
2 answers

Why is this Android Instrumentation Test invoking activity onCreate twice?

I have this test class: class InspirationalQuoteInstrumentedTest { private lateinit var server: MockWebServer @Rule @JvmField val mActivityRule: ActivityTestRule =…
nland
  • 669
  • 1
  • 7
  • 21
0
votes
1 answer

How to mock backend data in Angular2

I have been trying to post mock data using Angular2. I have tried the following links today but I was not successful. https://www.beyondjava.net/blog/mocking-http-services-with-angular-generically/ Below links are good but I could not make use of…
user8255292
0
votes
1 answer

MockWebServer throwing java.lang.reflect.InvocationTargetException

I'm following the code here: Android Unit Test with Retrofit2 and Mockito or Robolectric and I'm trying to run this code: mockWebServer.enqueue(new MockResponse().setBody("your json body")); Retrofit retrofit = new Retrofit.Builder() …
Mike6679
  • 5,547
  • 19
  • 63
  • 108
0
votes
0 answers

Espresso mockWebServer response does not intercept http calls

I am trying to intercept the network calls made in my espresso test so that I can override the response with the local copy and make the tests more deterministic .The problem I am facing is even though I setup the MockWebServer correctly I never see…
luckysing_noobster
  • 1,933
  • 5
  • 24
  • 50
0
votes
1 answer

MockWebServer not do callback

I'm trying to test our Android app using MockWebService. The request send to server is received correctly, however, the response didn't back to the client. This only happen when doing request asynchronously, when using httpclient directly it works…
Whispererli
  • 131
  • 2
  • 13
0
votes
0 answers

MissingMethodInvocationException testing an opened class in Kotlin

I'm trying to make some integration tests with Kotlin + RxJava and MockWebServer. I'm kind of newbie in terms of testing and I'm Kotlin apprentice. I know about the limitations of Mockito and final classes, but I shouldn't be mocking the class I'm…
cesards
  • 15,882
  • 11
  • 70
  • 65
-2
votes
1 answer

okhttp: non-static method redirectsToGet(String) cannot be referenced from a static context

Updated androidTestImplementation from com.squareup.okhttp3:mockwebserver:3.8.0' to com.squareup.okhttp3:mockwebserver:4.0.1' and started getting: non-static method redirectsToGet(String) cannot be referenced from a static context
Testing Singh
  • 1,347
  • 1
  • 15
  • 26
1 2 3
10
11