Search in sources :

Example 1 with ConsumerHttpsClient

use of au.com.dius.pact.consumer.junit.exampleclients.ConsumerHttpsClient 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("/", "");
}
Also used : ConsumerHttpsClient(au.com.dius.pact.consumer.junit.exampleclients.ConsumerHttpsClient) PactVerification(au.com.dius.pact.consumer.junit.PactVerification) Test(org.junit.Test)

Example 2 with ConsumerHttpsClient

use of au.com.dius.pact.consumer.junit.exampleclients.ConsumerHttpsClient 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);
}
Also used : ConsumerHttpsClient(au.com.dius.pact.consumer.junit.exampleclients.ConsumerHttpsClient) 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 3 with ConsumerHttpsClient

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

the class PactProviderHttpsTest method runTest.

@Test
@PactVerification(value = "test_provider")
public void runTest() throws IOException {
    LOGGER.info("Config: " + mockTestProvider.getConfig());
    Assert.assertEquals(new ConsumerHttpsClient(mockTestProvider.getConfig().url()).options("/second"), 200);
    Map expectedResponse = new HashMap();
    expectedResponse.put("responsetest", true);
    expectedResponse.put("name", "harry");
    assertEquals(new ConsumerHttpsClient(mockTestProvider.getConfig().url()).getAsMap("/", ""), expectedResponse);
}
Also used : ConsumerHttpsClient(au.com.dius.pact.consumer.junit.exampleclients.ConsumerHttpsClient) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) PactVerification(au.com.dius.pact.consumer.junit.PactVerification) Test(org.junit.Test)

Aggregations

PactVerification (au.com.dius.pact.consumer.junit.PactVerification)3 ConsumerHttpsClient (au.com.dius.pact.consumer.junit.exampleclients.ConsumerHttpsClient)3 Test (org.junit.Test)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2