use of au.com.dius.pact.consumer.junit.PactVerification in project pact-jvm by DiUS.
the class PactProviderWithMultipleFragmentsTest method runTestWithFragment2.
@Test
@PactVerification(value = "test_provider2", fragment = "createFragment2")
public void runTestWithFragment2() throws IOException {
Map expectedResponse = new HashMap();
expectedResponse.put("responsetest", true);
expectedResponse.put("name", "fred");
assertEquals(new ConsumerClient(mockTestProvider2.getUrl()).getAsMap("/", ""), expectedResponse);
}
use of au.com.dius.pact.consumer.junit.PactVerification in project pact-jvm by DiUS.
the class ArticlesTest method testArticles.
@PactVerification("ArticlesProvider")
@Test
public void testArticles() throws IOException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
ArticlesRestClient providerRestClient = new ArticlesRestClient();
providerRestClient.getArticles("http://localhost:1234");
}
use of au.com.dius.pact.consumer.junit.PactVerification in project pact-jvm by DiUS.
the class ExampleJavaConsumerPactRuleTest method runTest.
@Test
@PactVerification("test_provider")
public void runTest() throws IOException {
Assert.assertEquals(new ConsumerClient(provider.getUrl()).options("/second"), 200);
Map expectedResponse = new HashMap();
expectedResponse.put("responsetest", true);
expectedResponse.put("name", "harry");
assertEquals(new ConsumerClient(provider.getUrl()).getAsMap("/", ""), expectedResponse);
}
use of au.com.dius.pact.consumer.junit.PactVerification in project pact-jvm by DiUS.
the class ExampleServiceConsumerTest method testBookCar.
@PactVerification("CarBookingProvider")
@Test
public void testBookCar() throws IOException, ParseException {
ProviderCarBookingRestClient providerRestClient = new ProviderCarBookingRestClient();
ClassicHttpResponse response = providerRestClient.placeOrder(provider.getUrl(), DATA_A_ID, DATA_B_ID, "2015-03-15");
Assert.assertEquals(201, response.getCode());
String orderDetails = EntityUtils.toString(response.getEntity());
Assert.assertEquals("{\"id\":\"ORDER_ID_123456\"}", orderDetails);
}
use of au.com.dius.pact.consumer.junit.PactVerification in project pact-jvm by DiUS.
the class V3PactProviderTest method runTest.
@Test
@PactVerification
public void runTest() throws IOException {
Map expectedResponse = new HashMap();
expectedResponse.put("responsetest", true);
expectedResponse.put("version", "v3");
assertEquals(new ConsumerClient(mockTestProvider.getUrl()).getAsMap("/", ""), expectedResponse);
}
Aggregations