Search in sources :

Example 11 with ConsumerClient

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

the class PactDslJsonBodyTest method runTest.

@Override
protected void runTest(MockServer mockServer) {
    Map response;
    try {
        response = new ConsumerClient(mockServer.getUrl()).getAsMap("/", "");
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    Map<String, Object> object2 = (Map<String, Object>) response.get("2");
    assertThat(object2, hasKey("test"));
    assertThat(object2.get("test"), is(nullValue()));
}
Also used : ConsumerClient(au.com.dius.pact.consumer.exampleclients.ConsumerClient) Map(java.util.Map)

Example 12 with ConsumerClient

use of au.com.dius.pact.consumer.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("http://localhost:8080").options("/second"), 200);
    Map expectedResponse = new HashMap();
    expectedResponse.put("responsetest", true);
    expectedResponse.put("name", "harry");
    assertEquals(new ConsumerClient("http://localhost:8080").getAsMap("/", ""), expectedResponse);
}
Also used : ConsumerClient(au.com.dius.pact.consumer.exampleclients.ConsumerClient) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) PactVerification(au.com.dius.pact.consumer.PactVerification) Test(org.junit.Test)

Example 13 with ConsumerClient

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

the class V3ConsumerPactTest method runTest.

@Override
protected void runTest(MockServer mockServer) 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.exampleclients.ConsumerClient) HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap)

Example 14 with ConsumerClient

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

Aggregations

ConsumerClient (au.com.dius.pact.consumer.exampleclients.ConsumerClient)14 HashMap (java.util.HashMap)11 Map (java.util.Map)10 Test (org.junit.Test)8 PactVerification (au.com.dius.pact.consumer.PactVerification)7 PactVerificationResult (au.com.dius.pact.consumer.PactVerificationResult)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 Request (au.com.dius.pact.model.Request)1 IOException (java.io.IOException)1