use of au.com.dius.pact.consumer.PactVerification in project pact-jvm by DiUS.
the class PactProviderHttpsKeystoreTest method testSslHandshakeException.
@Test(expected = SSLHandshakeException.class)
@PactVerification(value = "test_provider")
public void testSslHandshakeException() throws IOException {
testKeystoreHappyPath();
new ConsumerHttpsClient(mockTestProvider.getConfig().url()).getAsMap("/", "");
}
use of au.com.dius.pact.consumer.PactVerification in project pact-jvm by DiUS.
the class PactProviderHttpsTest method runTestWithUserCodeFailure.
@Test(expected = AssertionError.class)
@PactVerification("test_provider")
public void runTestWithUserCodeFailure() throws IOException {
Assert.assertEquals(new ConsumerHttpsClient(mockTestProvider.getConfig().url()).options("/second"), 200);
Map expectedResponse = new HashMap();
expectedResponse.put("responsetest", true);
expectedResponse.put("name", "fred");
assertEquals(new ConsumerHttpsClient(mockTestProvider.getConfig().url()).getAsMap("/", ""), expectedResponse);
}
use of au.com.dius.pact.consumer.PactVerification in project pact-jvm by DiUS.
the class PactProviderTest method runTestWithPactError.
@Test
@PactVerification(value = "test_provider")
public void runTestWithPactError() throws IOException {
mockTestProvider.validateResultWith((result, t) -> {
assertThat(t, is(instanceOf(AssertionError.class)));
assertThat(t.getMessage(), startsWith("The following requests were not received:\n" + "\tmethod: GET\n" + "\tpath: /"));
assertThat(result, is(instanceOf(PactVerificationResult.ExpectedButNotReceived.class)));
PactVerificationResult.ExpectedButNotReceived error = (PactVerificationResult.ExpectedButNotReceived) result;
assertThat(error.getExpectedRequests(), hasSize(1));
Request request = error.getExpectedRequests().get(0);
assertThat(request.getPath(), is("/"));
});
Assert.assertEquals(new ConsumerClient(mockTestProvider.getUrl()).options("/second"), 200);
}
use of au.com.dius.pact.consumer.PactVerification in project pact-jvm by DiUS.
the class PactProviderTest method runTest.
@Test
@PactVerification(value = "test_provider")
public void runTest() throws IOException {
Assert.assertEquals(new ConsumerClient(mockTestProvider.getUrl()).options("/second"), 200);
Map expectedResponse = new HashMap();
expectedResponse.put("responsetest", true);
expectedResponse.put("name", "harry");
assertEquals(new ConsumerClient(mockTestProvider.getUrl()).getAsMap("/", ""), expectedResponse);
}
use of au.com.dius.pact.consumer.PactVerification in project pact-jvm by DiUS.
the class PactProviderWithMultipleFragmentsTest method runTestWithFragment1.
@Test
@PactVerification(value = "test_provider", fragment = "createFragment")
public void runTestWithFragment1() throws IOException {
Assert.assertEquals(new ConsumerClient(mockTestProvider.getUrl()).options("/second"), 200);
Map expectedResponse = new HashMap();
expectedResponse.put("responsetest", true);
expectedResponse.put("name", "harry");
assertEquals(new ConsumerClient(mockTestProvider.getUrl()).getAsMap("/", ""), expectedResponse);
}
Aggregations