@Test public void inRegistryButShouldNotMock_CallRealEndpoint() { givenWhenFunctionReturns(true); givenEndpointInRegistry(false); testee.newCall(REQUEST); verify(realClient).newCall(REQUEST); verify(mockClient, never()).newCall(any(Request.class)); }
@Override public Call newCall(Request request) { if (shouldMockRequest(request)) { return mockedClient.newCall(request); } else { return realClient.newCall(request); } }
MockableClient extends OkHttpClient { @Override public Call newCall(Request request) { if (shouldMockRequest(request)) { return mockedClient.newCall(request); } else { return realClient.newCall(request); } } }
MockableClient extends OkHttpClient { @Override public Call newCall(Request request) { if (shouldMockRequest(request)) { return mockedClient.newCall(request); } else { return realClient.newCall(request); } } MockableClient(Registry registry,
                   OkHttpClient realClient,
                   ReplaceEndpointClient mockedClient,
                   BooleanFunction mockWhenFunction); }
MockableClient extends OkHttpClient { @Override public Call newCall(Request request) { if (shouldMockRequest(request)) { return mockedClient.newCall(request); } else { return realClient.newCall(request); } } MockableClient(Registry registry,
                   OkHttpClient realClient,
                   ReplaceEndpointClient mockedClient,
                   BooleanFunction mockWhenFunction); @Override Call newCall(Request request); static MockableClient.Builder baseUrl(String mockedBaseUrl); }
MockableClient extends OkHttpClient { @Override public Call newCall(Request request) { if (shouldMockRequest(request)) { return mockedClient.newCall(request); } else { return realClient.newCall(request); } } MockableClient(Registry registry,
                   OkHttpClient realClient,
                   ReplaceEndpointClient mockedClient,
                   BooleanFunction mockWhenFunction); @Override Call newCall(Request request); static MockableClient.Builder baseUrl(String mockedBaseUrl);  }