From c1d934e8a4d3c010c55f406bda284d973624ca88 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Fri, 14 Aug 2020 17:36:47 +0200 Subject: [PATCH] BAEL-3975: Fix the PactVerification test (#9870) --- libraries-5/pom.xml | 14 +++-------- .../PactConsumerDrivenContractUnitTest.java | 25 ++++++++++++++----- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/libraries-5/pom.xml b/libraries-5/pom.xml index 63296d4a89..63347dd60d 100644 --- a/libraries-5/pom.xml +++ b/libraries-5/pom.xml @@ -32,12 +32,6 @@ pact-jvm-consumer-junit_2.11 ${pact.version} test - - - org.codehaus.groovy - groovy-all - - @@ -53,10 +47,10 @@ test - - one.util - streamex - ${streamex.version} + + one.util + streamex + ${streamex.version} net.bytebuddy diff --git a/libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java b/libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java index d8bc46985d..e4ac8a3a95 100644 --- a/libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java +++ b/libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java @@ -5,8 +5,6 @@ import au.com.dius.pact.consumer.PactProviderRuleMk2; import au.com.dius.pact.consumer.PactVerification; import au.com.dius.pact.consumer.dsl.PactDslWithProvider; import au.com.dius.pact.model.RequestResponsePact; - -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.springframework.http.HttpEntity; @@ -28,15 +26,30 @@ public class PactConsumerDrivenContractUnitTest { @Pact(consumer = "test_consumer") public RequestResponsePact createPact(PactDslWithProvider builder) { - Map headers = new HashMap(); + Map headers = new HashMap<>(); headers.put("Content-Type", "application/json"); - return builder.given("test GET").uponReceiving("GET REQUEST").path("/pact").method("GET").willRespondWith().status(200).headers(headers).body("{\"condition\": true, \"name\": \"tom\"}").given("test POST").uponReceiving("POST REQUEST").method("POST") - .headers(headers).body("{\"name\": \"Michael\"}").path("/pact").willRespondWith().status(201).toPact(); + return builder + .given("test GET") + .uponReceiving("GET REQUEST") + .path("/pact") + .method("GET") + .willRespondWith() + .status(200) + .headers(headers) + .body("{\"condition\": true, \"name\": \"tom\"}") + .given("test POST") + .uponReceiving("POST REQUEST") + .method("POST") + .headers(headers) + .body("{\"name\": \"Michael\"}") + .path("/pact") + .willRespondWith() + .status(201) + .toPact(); } @Test - @Ignore @PactVerification() public void givenGet_whenSendRequest_shouldReturn200WithProperHeaderAndBody() { // when