Search in sources :

Example 16 with PactVerification

use of au.com.dius.pact.consumer.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("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 17 with PactVerification

use of au.com.dius.pact.consumer.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);
}
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 18 with PactVerification

use of au.com.dius.pact.consumer.PactVerification in project verify-hub by alphagov.

the class EidasSessionResourceContractTest method shouldGetValidatedEidasAuthnResponseFromSamlEngineVerification.

@PactVerification(value = SAML_ENGINE_SERVICE, fragment = "shouldGetValidatedEidasAuthnResponseFromSamlEngine")
@Test
public void shouldGetValidatedEidasAuthnResponseFromSamlEngineVerification() throws Exception {
    configStub.setupStubForEidasRPCountries(TEST_RP, EIDAS_COUNTRIES.stream().map(EidasCountryDto::getEntityId).collect(Collectors.toList()));
    SessionId sessionId = createSessionInCountrySelectingState();
    selectACountry(sessionId);
    Response response = postAuthnResponseToPolicy(sessionId);
    assertThatResponseIsSuccess(response);
    assertThatAQRReceivedBySamlSoapProxyHasSameDataAsSamlEngineSent();
}
Also used : Response(javax.ws.rs.core.Response) EidasCountryDto(uk.gov.ida.hub.policy.domain.EidasCountryDto) SessionId(uk.gov.ida.hub.policy.domain.SessionId) PactVerification(au.com.dius.pact.consumer.PactVerification) Test(org.junit.Test)

Aggregations

PactVerification (au.com.dius.pact.consumer.PactVerification)18 Test (org.junit.Test)18 HashMap (java.util.HashMap)8 Map (java.util.Map)8 ConsumerClient (au.com.dius.pact.consumer.exampleclients.ConsumerClient)7 PactVerificationResult (au.com.dius.pact.consumer.PactVerificationResult)5 ConsumerHttpsClient (au.com.dius.pact.consumer.exampleclients.ConsumerHttpsClient)3 RequestPartMismatch (au.com.dius.pact.model.RequestPartMismatch)2 ArticlesRestClient (au.com.dius.pact.consumer.exampleclients.ArticlesRestClient)1 MockHttpsKeystoreProviderConfig (au.com.dius.pact.model.MockHttpsKeystoreProviderConfig)1 MockHttpsProviderConfig (au.com.dius.pact.model.MockHttpsProviderConfig)1 Request (au.com.dius.pact.model.Request)1 File (java.io.File)1 Response (javax.ws.rs.core.Response)1 HttpResponse (org.apache.http.HttpResponse)1 EidasCountryDto (uk.gov.ida.hub.policy.domain.EidasCountryDto)1 SessionId (uk.gov.ida.hub.policy.domain.SessionId)1