@Test public void replaceUrl() { Request realRequest = new Request.Builder() .url(REAL_BASE_URL + PATH) .build(); testee.newCall(realRequest); ArgumentCaptor<Request> requestCaptor = ArgumentCaptor.forClass(Request.class); Mockito.verify(realClient).newCall(requestCaptor.capture()); Request sentRequest = requestCaptor.getValue(); assertEquals(MOCK_BASE_URL + PATH, sentRequest.url().toString()); }
@Override public Call newCall(Request request) { return realClient.newCall( withReplacedEndpoint(request) ); }
ReplaceEndpointClient extends OkHttpClient { @Override public Call newCall(Request request) { return realClient.newCall( withReplacedEndpoint(request) ); } }
ReplaceEndpointClient extends OkHttpClient { @Override public Call newCall(Request request) { return realClient.newCall( withReplacedEndpoint(request) ); } ReplaceEndpointClient(String newEndpoint,
                          OkHttpClient realClient); }
ReplaceEndpointClient extends OkHttpClient { @Override public Call newCall(Request request) { return realClient.newCall( withReplacedEndpoint(request) ); } ReplaceEndpointClient(String newEndpoint,
                          OkHttpClient realClient); @Override Call newCall(Request request); }
ReplaceEndpointClient extends OkHttpClient { @Override public Call newCall(Request request) { return realClient.newCall( withReplacedEndpoint(request) ); } ReplaceEndpointClient(String newEndpoint,
                          OkHttpClient realClient); @Override Call newCall(Request request);  }