use of au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient 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.junit.exampleclients.ConsumerClient in project pact-jvm by DiUS.
the class MissingRequestConsumerPassesTest method runTest.
@Override
protected void runTest(MockServer mockServer, PactTestExecutionContext context) throws IOException {
Map<String, Object> expectedResponse = new HashMap<String, Object>();
expectedResponse.put("responsetest", true);
expectedResponse.put("name", "fred");
ConsumerClient consumerClient = new ConsumerClient(mockServer.getUrl());
assertEquals(consumerClient.getAsMap("/", ""), expectedResponse);
}
use of au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient in project pact-jvm by DiUS.
the class StatusCodeMatcherPactTest method runTest.
@Test
@PactVerification
public void runTest() throws IOException {
Map expectedResponse = Map.of("responsetest", true, "version", "v3");
assertEquals(new ConsumerClient(mockTestProvider.getUrl()).getAsMap("/", ""), expectedResponse);
}
use of au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient in project pact-jvm by DiUS.
the class PactProviderWithMultipleFragmentsTest method runTestWithAllFragments.
@Test
@PactVerifications({ @PactVerification(value = "test_provider", fragment = "createFragment"), @PactVerification(value = "test_provider2", fragment = "createFragment2"), @PactVerification(value = "test_provider2", fragment = "createFragment3") })
public void runTestWithAllFragments() 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);
expectedResponse = new HashMap();
expectedResponse.put("responsetest", true);
expectedResponse.put("name", "fred");
assertEquals(new ConsumerClient(mockTestProvider2.getUrl()).getAsMap("/", ""), expectedResponse);
try {
new ConsumerClient(mockTestProvider2.getUrl()).getAsMap("/path/2", "");
fail();
} catch (IOException ex) {
ex.printStackTrace();
// assertThat(ex.getStatusCode(), is(404));
}
}
use of au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient in project pact-jvm by DiUS.
the class PactRuleWithRandomPortTest method runTest.
@Test
@PactVerification("test_provider")
public void runTest() throws IOException {
Map expectedResponse = new HashMap();
assertEquals(new ConsumerClient("http://localhost:" + rule.getPort()).getAsMap("/", ""), expectedResponse);
}
Aggregations