Search in sources :

Example 1 with HttpResponseException

use of org.apache.hc.client5.http.HttpResponseException in project pact-jvm by DiUS.

the class PactConsumer400Test method runTestAndHandleTheException.

@Test
@PactVerification("test_provider")
public void runTestAndHandleTheException() throws IOException {
    try {
        new ConsumerClient("http://localhost:" + rule.getPort()).getAsMap("/does-not-exist", "");
        fail("Should have thrown an exception");
    } catch (HttpResponseException e) {
    // correct behaviour
    }
}
Also used : ConsumerClient(au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient) HttpResponseException(org.apache.hc.client5.http.HttpResponseException) Test(org.junit.Test)

Aggregations

ConsumerClient (au.com.dius.pact.consumer.junit.exampleclients.ConsumerClient)1 HttpResponseException (org.apache.hc.client5.http.HttpResponseException)1 Test (org.junit.Test)1