diff --git a/src/test/java/AuthFailureTest.java b/src/test/java/AuthFailureTest.java index 9649885..bb75169 100644 --- a/src/test/java/AuthFailureTest.java +++ b/src/test/java/AuthFailureTest.java @@ -50,12 +50,10 @@ public void stopProxy() { } private void createMock(final int statusCode) { - final MockServerClient client = new MockServerClient("127.0.0.1", 1081); - - client.when(request().withMethod("POST").withPath("/oauth2/token")) - .respond(response().withStatusCode(statusCode)); - client.when(request().withMethod("GET").withPath("/search/images") - .withQueryStringParameters(new Parameter("phrase", "cat"))) - .respond(response().withStatusCode(200).withBody("success")); + authClientMock.when(request().withMethod("POST").withPath("/oauth2/token")) + .respond(response().withStatusCode(statusCode)); + apiClientMock.when(request().withMethod("GET").withPath("/search/images") + .withQueryStringParameters(new Parameter("phrase", "cat"))) + .respond(response().withStatusCode(200).withBody("success")); } } diff --git a/src/test/java/TestBase.java b/src/test/java/TestBase.java index a4480d8..cbefb35 100644 --- a/src/test/java/TestBase.java +++ b/src/test/java/TestBase.java @@ -11,8 +11,8 @@ public class TestBase { private ClientAndServer apiServerMock; protected MockServerClient apiClientMock; - private ClientAndServer authServerMock; - private MockServerClient authClientMock; + protected ClientAndServer authServerMock; + protected MockServerClient authClientMock; protected void startMockServersAndSetupAuth() throws Exception { startMockServers();