Search in sources :

Example 6 with ConsumerClient

use of au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient 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);
}
Also used : ConsumerClient(au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) PactVerification(au.com.dius.pact.consumer.junit.PactVerification) Test(org.junit.Test)

Example 7 with ConsumerClient

use of au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient 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);
}
Also used : ConsumerClient(au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) PactVerification(au.com.dius.pact.consumer.junit.PactVerification) Test(org.junit.Test)

Example 8 with ConsumerClient

use of au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient in project pact-jvm by DiUS.

the class V3ConsumerPactTest method runTest.

@Override
protected void runTest(MockServer mockServer, PactTestExecutionContext context) throws IOException {
    Map expectedResponse = new HashMap();
    expectedResponse.put("responsetest", true);
    expectedResponse.put("version", "v3");
    assertEquals(new ConsumerClient(mockServer.getUrl()).getAsMap("/", ""), expectedResponse);
}
Also used : ConsumerClient(au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient) HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap)

Example 9 with ConsumerClient

use of au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient 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);
}
Also used : ConsumerClient(au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) PactVerification(au.com.dius.pact.consumer.junit.PactVerification) Test(org.junit.Test)

Example 10 with ConsumerClient

use of au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient in project pact-jvm by DiUS.

the class V4HttpPactTest method runTest.

@Test
@PactVerification
public void runTest() throws IOException {
    Map expectedResponse = Map.of("responsetest", true, "version", "v3");
    assertEquals(new ConsumerClient(mockTestProvider.getUrl()).getAsMap("/", ""), expectedResponse);
}
Also used : ConsumerClient(au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient) Map(java.util.Map) PactVerification(au.com.dius.pact.consumer.junit.PactVerification) Test(org.junit.Test)

Aggregations

ConsumerClient (au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient)19 Map (java.util.Map)14 HashMap (java.util.HashMap)13 Test (org.junit.Test)13 PactVerification (au.com.dius.pact.consumer.junit.PactVerification)9 PactVerificationResult (au.com.dius.pact.consumer.PactVerificationResult)2 PactVerifications (au.com.dius.pact.consumer.junit.PactVerifications)2 IOException (java.io.IOException)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 IRequest (au.com.dius.pact.core.model.IRequest)1 HttpResponseException (org.apache.hc.client5.http.HttpResponseException)1