contracts: consumer-driven contract testing lab (Spring Cloud Contract 5.0.3, Stubborn Contract 0.2.4, Pact JVM 4.7.7 on Spring Boot 4.2.0)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7h4ZNF4BDUpJk3Zou
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# JDK
|
||||
openjdk version "25.0.5.1" 2026-11-17 LTS
|
||||
OpenJDK Runtime Environment Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS)
|
||||
OpenJDK 64-Bit Server VM Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS, mixed mode, sharing)
|
||||
|
||||
# Maven
|
||||
Apache Maven 3.9.11 (3e54c93a704957b63ee3494413a2b544fd3d825b)
|
||||
|
||||
# producer, resolved test-scope contract libraries
|
||||
org.springframework.cloud:spring-cloud-starter-contract-verifier:jar:5.0.3:test
|
||||
org.springframework.cloud:spring-cloud-contract-verifier:jar:5.0.3:test
|
||||
org.springframework.cloud:spring-cloud-contract-spec-groovy:jar:5.0.3:test
|
||||
org.wiremock:wiremock-standalone:jar:3.13.2:test
|
||||
org.apache.groovy:groovy:jar:5.1.3:test
|
||||
io.rest-assured:rest-assured:jar:7.0.0:test
|
||||
au.com.dius.pact.provider:junit5:jar:4.7.7:test
|
||||
au.com.dius.pact:provider:jar:4.7.7:test
|
||||
|
||||
# consumer, resolved test-scope libraries
|
||||
org.springframework.boot:spring-boot-starter-restclient:jar:4.2.0:compile
|
||||
org.springframework.cloud:spring-cloud-starter-contract-stub-runner:jar:5.0.3:test
|
||||
org.springframework.cloud:spring-cloud-contract-stub-runner:jar:5.0.3:test
|
||||
org.springframework.cloud:spring-cloud-contract-wiremock:jar:5.0.3:test
|
||||
org.wiremock:wiremock-standalone:jar:3.13.2:test
|
||||
au.com.dius.pact.consumer:junit5:jar:4.7.7:test
|
||||
@@ -0,0 +1,4 @@
|
||||
[INFO] Running com.ankurm.contracts.checkout.OrdersPactConsumerTest
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: N s -- in com.ankurm.contracts.checkout.OrdersPactConsumerTest
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] BUILD SUCCESS
|
||||
@@ -0,0 +1,166 @@
|
||||
{
|
||||
"consumer": {
|
||||
"name": "checkout-consumer"
|
||||
},
|
||||
"interactions": [
|
||||
{
|
||||
"description": "a request for order 42",
|
||||
"providerStates": [
|
||||
{
|
||||
"name": "order 42 exists and is confirmed"
|
||||
}
|
||||
],
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"path": "/orders/42"
|
||||
},
|
||||
"response": {
|
||||
"body": {
|
||||
"id": 42,
|
||||
"status": "CONFIRMED",
|
||||
"total": 129.9
|
||||
},
|
||||
"headers": {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"matchingRules": {
|
||||
"body": {
|
||||
"$.id": {
|
||||
"combine": "AND",
|
||||
"matchers": [
|
||||
{
|
||||
"match": "integer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"$.status": {
|
||||
"combine": "AND",
|
||||
"matchers": [
|
||||
{
|
||||
"match": "type"
|
||||
}
|
||||
]
|
||||
},
|
||||
"$.total": {
|
||||
"combine": "AND",
|
||||
"matchers": [
|
||||
{
|
||||
"match": "decimal"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "a request for an unknown order",
|
||||
"providerStates": [
|
||||
{
|
||||
"name": "order 999 does not exist"
|
||||
}
|
||||
],
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"path": "/orders/999"
|
||||
},
|
||||
"response": {
|
||||
"status": 404
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "a request to create an order",
|
||||
"providerStates": [
|
||||
{
|
||||
"name": "orders can be created"
|
||||
}
|
||||
],
|
||||
"request": {
|
||||
"body": {
|
||||
"items": [
|
||||
{
|
||||
"qty": 2,
|
||||
"sku": "BOOK-1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"headers": {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"matchingRules": {
|
||||
"body": {
|
||||
"$.items[0].qty": {
|
||||
"combine": "AND",
|
||||
"matchers": [
|
||||
{
|
||||
"match": "integer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"$.items[0].sku": {
|
||||
"combine": "AND",
|
||||
"matchers": [
|
||||
{
|
||||
"match": "type"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"method": "POST",
|
||||
"path": "/orders"
|
||||
},
|
||||
"response": {
|
||||
"body": {
|
||||
"id": 1001,
|
||||
"status": "NEW",
|
||||
"total": 129.9
|
||||
},
|
||||
"headers": {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"matchingRules": {
|
||||
"body": {
|
||||
"$.id": {
|
||||
"combine": "AND",
|
||||
"matchers": [
|
||||
{
|
||||
"match": "integer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"$.status": {
|
||||
"combine": "AND",
|
||||
"matchers": [
|
||||
{
|
||||
"match": "type"
|
||||
}
|
||||
]
|
||||
},
|
||||
"$.total": {
|
||||
"combine": "AND",
|
||||
"matchers": [
|
||||
{
|
||||
"match": "decimal"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"status": 201
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"pact-jvm": {
|
||||
"version": "4.7.7"
|
||||
},
|
||||
"pactSpecification": {
|
||||
"version": "3.0.0"
|
||||
}
|
||||
},
|
||||
"provider": {
|
||||
"name": "orders-producer"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
[INFO] Running com.ankurm.contracts.orders.OrdersTest
|
||||
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: N s -- in com.ankurm.contracts.orders.OrdersTest
|
||||
[INFO] Running com.ankurm.contracts.orders.OrdersPactVerificationTest
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given order 42 exists and is confirmed
|
||||
a request for order 42
|
||||
returns a response which
|
||||
has status code 200 (OK)
|
||||
has a matching body (OK)
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given order 999 does not exist
|
||||
a request for an unknown order
|
||||
returns a response which
|
||||
has status code 404 (OK)
|
||||
has a matching body (OK)
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given orders can be created
|
||||
a request to create an order
|
||||
returns a response which
|
||||
has status code 201 (OK)
|
||||
has a matching body (OK)
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: N s -- in com.ankurm.contracts.orders.OrdersPactVerificationTest
|
||||
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] BUILD SUCCESS
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.ankurm.contracts.orders;
|
||||
|
||||
import com.ankurm.contracts.orders.ContractVerifierBase;
|
||||
import com.jayway.jsonpath.DocumentContext;
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
import static org.springframework.cloud.contract.verifier.assertion.SpringCloudContractAssertions.assertThat;
|
||||
import static org.springframework.cloud.contract.verifier.util.ContractVerifierUtil.*;
|
||||
import static com.toomuchcoding.jsonassert.JsonAssertion.assertThatJson;
|
||||
import static io.restassured.RestAssured.*;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class OrdersTest extends ContractVerifierBase {
|
||||
|
||||
@Test
|
||||
public void validate_shouldCreateOrder() throws Exception {
|
||||
// given:
|
||||
RequestSpecification request = given()
|
||||
.header("Content-Type", "application/json")
|
||||
.body("{\"items\":[{\"sku\":\"BOOK-1\",\"qty\":2}]}");
|
||||
|
||||
// when:
|
||||
Response response = given().spec(request)
|
||||
|
||||
.post("/orders");
|
||||
|
||||
// then:
|
||||
assertThat(response.statusCode()).isEqualTo(201);
|
||||
assertThat(response.header("Content-Type")).isEqualTo("application/json");
|
||||
|
||||
|
||||
// and:
|
||||
DocumentContext parsedJson = JsonPath.parse(response.getBody().asString());
|
||||
assertThatJson(parsedJson).field("['id']").isEqualTo(1001);
|
||||
assertThatJson(parsedJson).field("['status']").isEqualTo("NEW");
|
||||
assertThatJson(parsedJson).field("['total']").isEqualTo(129.9);
|
||||
assertThatJson(parsedJson).field("['currency']").isEqualTo("INR");
|
||||
assertThatJson(parsedJson).array("['items']").contains("['sku']").isEqualTo("BOOK-1");
|
||||
assertThatJson(parsedJson).array("['items']").contains("['qty']").isEqualTo(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validate_shouldReturn404ForUnknownOrder() throws Exception {
|
||||
// given:
|
||||
RequestSpecification request = given();
|
||||
|
||||
|
||||
// when:
|
||||
Response response = given().spec(request)
|
||||
|
||||
.get("/orders/999");
|
||||
|
||||
// then:
|
||||
assertThat(response.statusCode()).isEqualTo(404);
|
||||
assertThat(response.header("Content-Type")).isEqualTo("application/json");
|
||||
|
||||
|
||||
// and:
|
||||
DocumentContext parsedJson = JsonPath.parse(response.getBody().asString());
|
||||
assertThatJson(parsedJson).field("['error']").isEqualTo("ORDER_NOT_FOUND");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validate_shouldReturnOrder() throws Exception {
|
||||
// given:
|
||||
RequestSpecification request = given();
|
||||
|
||||
|
||||
// when:
|
||||
Response response = given().spec(request)
|
||||
|
||||
.get("/orders/42");
|
||||
|
||||
// then:
|
||||
assertThat(response.statusCode()).isEqualTo(200);
|
||||
assertThat(response.header("Content-Type")).isEqualTo("application/json");
|
||||
|
||||
|
||||
// and:
|
||||
DocumentContext parsedJson = JsonPath.parse(response.getBody().asString());
|
||||
assertThatJson(parsedJson).field("['id']").isEqualTo(42);
|
||||
assertThatJson(parsedJson).field("['status']").isEqualTo("CONFIRMED");
|
||||
assertThatJson(parsedJson).field("['total']").isEqualTo(129.9);
|
||||
assertThatJson(parsedJson).field("['currency']").isEqualTo("INR");
|
||||
assertThatJson(parsedJson).array("['items']").contains("['sku']").isEqualTo("BOOK-1");
|
||||
assertThatJson(parsedJson).array("['items']").contains("['qty']").isEqualTo(2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
Archive: /root/.m2/repository/com/ankurm/contracts/orders-producer/1.0.0/orders-producer-1.0.0-stubs.jar
|
||||
Length Date Time Name
|
||||
--------- ---------- ----- ----
|
||||
0 META-INF/
|
||||
112 META-INF/MANIFEST.MF
|
||||
0 META-INF/com.ankurm.contracts/
|
||||
0 META-INF/com.ankurm.contracts/orders-producer/
|
||||
0 META-INF/com.ankurm.contracts/orders-producer/1.0.0/
|
||||
0 META-INF/com.ankurm.contracts/orders-producer/1.0.0/mappings/
|
||||
0 META-INF/com.ankurm.contracts/orders-producer/1.0.0/mappings/orders/
|
||||
0 META-INF/com.ankurm.contracts/orders-producer/1.0.0/contracts/
|
||||
0 META-INF/com.ankurm.contracts/orders-producer/1.0.0/contracts/orders/
|
||||
487 META-INF/com.ankurm.contracts/orders-producer/1.0.0/mappings/orders/shouldReturnOrder.json
|
||||
752 META-INF/com.ankurm.contracts/orders-producer/1.0.0/mappings/orders/shouldCreateOrder.json
|
||||
403 META-INF/com.ankurm.contracts/orders-producer/1.0.0/mappings/orders/shouldReturn404ForUnknownOrder.json
|
||||
313 META-INF/com.ankurm.contracts/orders-producer/1.0.0/contracts/orders/shouldReturnOrder.yml
|
||||
248 META-INF/com.ankurm.contracts/orders-producer/1.0.0/contracts/orders/shouldReturn404ForUnknownOrder.yml
|
||||
435 META-INF/com.ankurm.contracts/orders-producer/1.0.0/contracts/orders/shouldCreateOrder.yml
|
||||
--------- -------
|
||||
2750 15 files
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"id" : "e82107a2-c24d-4c1b-83e5-76e63809afb2",
|
||||
"request" : {
|
||||
"urlPath" : "/orders/42",
|
||||
"method" : "GET"
|
||||
},
|
||||
"response" : {
|
||||
"status" : 200,
|
||||
"body" : "{\"id\":42,\"status\":\"CONFIRMED\",\"total\":129.9,\"currency\":\"INR\",\"items\":[{\"sku\":\"BOOK-1\",\"qty\":2}]}",
|
||||
"headers" : {
|
||||
"Content-Type" : "application/json"
|
||||
},
|
||||
"transformers" : [ "response-template", "spring-cloud-contract" ]
|
||||
},
|
||||
"uuid" : "e82107a2-c24d-4c1b-83e5-76e63809afb2"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
[INFO] Running com.ankurm.contracts.checkout.OrdersStubConsumerTest
|
||||
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: N s -- in com.ankurm.contracts.checkout.OrdersStubConsumerTest
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] BUILD SUCCESS
|
||||
@@ -0,0 +1,31 @@
|
||||
[INFO] Running com.ankurm.contracts.orders.OrdersTest
|
||||
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: N s -- in com.ankurm.contracts.orders.OrdersTest
|
||||
[INFO] Running com.ankurm.contracts.orders.OrdersPactVerificationTest
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given order 42 exists and is confirmed
|
||||
a request for order 42
|
||||
returns a response which
|
||||
has status code 200 (OK)
|
||||
has a matching body (OK)
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given order 999 does not exist
|
||||
a request for an unknown order
|
||||
returns a response which
|
||||
has status code 404 (OK)
|
||||
has a matching body (OK)
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given orders can be created
|
||||
a request to create an order
|
||||
returns a response which
|
||||
has status code 201 (OK)
|
||||
has a matching body (OK)
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: N s -- in com.ankurm.contracts.orders.OrdersPactVerificationTest
|
||||
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] BUILD SUCCESS
|
||||
@@ -0,0 +1,128 @@
|
||||
[INFO] Running com.ankurm.contracts.orders.OrdersTest
|
||||
|
||||
[ERROR] Tests run: 3, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: N s <<< FAILURE! -- in com.ankurm.contracts.orders.OrdersTest
|
||||
[ERROR] com.ankurm.contracts.orders.OrdersTest.validate_shouldReturnOrder -- Time elapsed: N s <<< ERROR!
|
||||
java.lang.IllegalStateException: Parsed JSON [{"id":42,"status":"CONFIRMED","totalAmount":129.9,"currency":"INR","items":[{"sku":"BOOK-1","qty":2}]}] doesn't match the JSON path [$[?(@.['total'] == 129.9)]]
|
||||
|
||||
[ERROR] com.ankurm.contracts.orders.OrdersTest.validate_shouldCreateOrder -- Time elapsed: N s <<< ERROR!
|
||||
java.lang.IllegalStateException: Parsed JSON [{"id":1001,"status":"NEW","totalAmount":129.9,"currency":"INR","items":[{"sku":"BOOK-1","qty":2}]}] doesn't match the JSON path [$[?(@.['total'] == 129.9)]]
|
||||
|
||||
[INFO] Running com.ankurm.contracts.orders.OrdersPactVerificationTest
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given order 42 exists and is confirmed
|
||||
a request for order 42
|
||||
returns a response which
|
||||
has status code 200 (OK)
|
||||
has a matching body (FAILED)
|
||||
|
||||
Failures:
|
||||
|
||||
1) Verifying a pact between checkout-consumer and orders-producer - a request for order 42 has a matching body
|
||||
|
||||
1.1) body: $ Actual map is missing the following keys: total
|
||||
|
||||
{
|
||||
"id": 42,
|
||||
"status": "CONFIRMED",
|
||||
- "total": 129.9
|
||||
+ "totalAmount": 129.90
|
||||
}
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given order 999 does not exist
|
||||
a request for an unknown order
|
||||
returns a response which
|
||||
has status code 404 (OK)
|
||||
has a matching body (OK)
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given orders can be created
|
||||
a request to create an order
|
||||
returns a response which
|
||||
has status code 201 (OK)
|
||||
has a matching body (FAILED)
|
||||
|
||||
Failures:
|
||||
|
||||
1) Verifying a pact between checkout-consumer and orders-producer - a request to create an order has a matching body
|
||||
|
||||
1.1) body: $ Actual map is missing the following keys: total
|
||||
|
||||
{
|
||||
"id": 1001,
|
||||
"status": "NEW",
|
||||
- "total": 129.9
|
||||
+ "totalAmount": 129.90
|
||||
}
|
||||
|
||||
[ERROR] Tests run: 3, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: N s <<< FAILURE! -- in com.ankurm.contracts.orders.OrdersPactVerificationTest
|
||||
[ERROR] com.ankurm.contracts.orders.OrdersPactVerificationTest.verifyPact(PactVerificationContext)[1] -- Time elapsed: N s <<< FAILURE!
|
||||
java.lang.AssertionError:
|
||||
checkout-consumer - Upon a request for order 42
|
||||
Failures:
|
||||
|
||||
1) Verifying a pact between checkout-consumer and orders-producer - a request for order 42 has a matching body
|
||||
|
||||
1.1) body: $ Actual map is missing the following keys: total
|
||||
|
||||
{
|
||||
"id": 42,
|
||||
"status": "CONFIRMED",
|
||||
- "total": 129.9
|
||||
+ "totalAmount": 129.90
|
||||
}
|
||||
|
||||
[ERROR] com.ankurm.contracts.orders.OrdersPactVerificationTest.verifyPact(PactVerificationContext)[3] -- Time elapsed: N s <<< FAILURE!
|
||||
java.lang.AssertionError:
|
||||
checkout-consumer - Upon a request to create an order
|
||||
Failures:
|
||||
|
||||
1) Verifying a pact between checkout-consumer and orders-producer - a request to create an order has a matching body
|
||||
|
||||
1.1) body: $ Actual map is missing the following keys: total
|
||||
|
||||
{
|
||||
"id": 1001,
|
||||
"status": "NEW",
|
||||
- "total": 129.9
|
||||
+ "totalAmount": 129.90
|
||||
}
|
||||
|
||||
[ERROR] Failures:
|
||||
[ERROR] OrdersPactVerificationTest.verifyPact:43 checkout-consumer - Upon a request for order 42
|
||||
Failures:
|
||||
|
||||
1) Verifying a pact between checkout-consumer and orders-producer - a request for order 42 has a matching body
|
||||
|
||||
1.1) body: $ Actual map is missing the following keys: total
|
||||
|
||||
{
|
||||
"id": 42,
|
||||
"status": "CONFIRMED",
|
||||
- "total": 129.9
|
||||
+ "totalAmount": 129.90
|
||||
}
|
||||
|
||||
[ERROR] OrdersPactVerificationTest.verifyPact:43 checkout-consumer - Upon a request to create an order
|
||||
Failures:
|
||||
|
||||
1) Verifying a pact between checkout-consumer and orders-producer - a request to create an order has a matching body
|
||||
|
||||
1.1) body: $ Actual map is missing the following keys: total
|
||||
|
||||
{
|
||||
"id": 1001,
|
||||
"status": "NEW",
|
||||
- "total": 129.9
|
||||
+ "totalAmount": 129.90
|
||||
}
|
||||
|
||||
[ERROR] Errors:
|
||||
[ERROR] OrdersTest.validate_shouldCreateOrder:40 ? IllegalState Parsed JSON [{"id":1001,"status":"NEW","totalAmount":129.9,"currency":"INR","items":[{"sku":"BOOK-1","qty":2}]}] doesn't match the JSON path [$[?(@.['total'] == 129.9)]]
|
||||
[ERROR] OrdersTest.validate_shouldReturnOrder:87 ? IllegalState Parsed JSON [{"id":42,"status":"CONFIRMED","totalAmount":129.9,"currency":"INR","items":[{"sku":"BOOK-1","qty":2}]}] doesn't match the JSON path [$[?(@.['total'] == 129.9)]]
|
||||
[ERROR] Tests run: 6, Failures: 2, Errors: 2, Skipped: 0
|
||||
[INFO] BUILD FAILURE
|
||||
@@ -0,0 +1,46 @@
|
||||
[INFO] Running com.ankurm.contracts.orders.OrdersTest
|
||||
|
||||
com.jayway.jsonpath.PathNotFoundException: Missing property in path $['items']
|
||||
|
||||
com.jayway.jsonpath.PathNotFoundException: Missing property in path $['items']
|
||||
|
||||
[ERROR] Tests run: 3, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: N s <<< FAILURE! -- in com.ankurm.contracts.orders.OrdersTest
|
||||
[ERROR] com.ankurm.contracts.orders.OrdersTest.validate_shouldReturnOrder -- Time elapsed: N s <<< ERROR!
|
||||
java.lang.RuntimeException: com.jayway.jsonpath.PathNotFoundException: Missing property in path $['items']
|
||||
Caused by: com.jayway.jsonpath.PathNotFoundException: Missing property in path $['items']
|
||||
|
||||
[ERROR] com.ankurm.contracts.orders.OrdersTest.validate_shouldCreateOrder -- Time elapsed: N s <<< ERROR!
|
||||
java.lang.RuntimeException: com.jayway.jsonpath.PathNotFoundException: Missing property in path $['items']
|
||||
Caused by: com.jayway.jsonpath.PathNotFoundException: Missing property in path $['items']
|
||||
|
||||
[INFO] Running com.ankurm.contracts.orders.OrdersPactVerificationTest
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given order 42 exists and is confirmed
|
||||
a request for order 42
|
||||
returns a response which
|
||||
has status code 200 (OK)
|
||||
has a matching body (OK)
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given order 999 does not exist
|
||||
a request for an unknown order
|
||||
returns a response which
|
||||
has status code 404 (OK)
|
||||
has a matching body (OK)
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given orders can be created
|
||||
a request to create an order
|
||||
returns a response which
|
||||
has status code 201 (OK)
|
||||
has a matching body (OK)
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: N s -- in com.ankurm.contracts.orders.OrdersPactVerificationTest
|
||||
[ERROR] Errors:
|
||||
[ERROR] OrdersTest.validate_shouldCreateOrder:42 ? Runtime com.jayway.jsonpath.PathNotFoundException: Missing property in path $['items']
|
||||
[ERROR] OrdersTest.validate_shouldReturnOrder:89 ? Runtime com.jayway.jsonpath.PathNotFoundException: Missing property in path $['items']
|
||||
[ERROR] Tests run: 6, Failures: 0, Errors: 2, Skipped: 0
|
||||
[INFO] BUILD FAILURE
|
||||
@@ -0,0 +1,86 @@
|
||||
[INFO] Running com.ankurm.contracts.orders.OrdersTest
|
||||
|
||||
[ERROR] Tests run: 3, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: N s <<< FAILURE! -- in com.ankurm.contracts.orders.OrdersTest
|
||||
[ERROR] com.ankurm.contracts.orders.OrdersTest.validate_shouldReturnOrder -- Time elapsed: N s <<< ERROR!
|
||||
java.lang.IllegalStateException: Parsed JSON [{"id":42,"status":"CONFIRMED","total":"129.90","currency":"INR","items":[{"sku":"BOOK-1","qty":2}]}] doesn't match the JSON path [$[?(@.['total'] == 129.9)]]
|
||||
|
||||
[ERROR] com.ankurm.contracts.orders.OrdersTest.validate_shouldCreateOrder -- Time elapsed: N s <<< ERROR!
|
||||
java.lang.IllegalStateException: Parsed JSON [{"id":1001,"status":"NEW","total":"129.90","currency":"INR","items":[{"sku":"BOOK-1","qty":2}]}] doesn't match the JSON path [$[?(@.['total'] == 129.9)]]
|
||||
|
||||
[INFO] Running com.ankurm.contracts.orders.OrdersPactVerificationTest
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given order 42 exists and is confirmed
|
||||
a request for order 42
|
||||
returns a response which
|
||||
has status code 200 (OK)
|
||||
has a matching body (FAILED)
|
||||
|
||||
Failures:
|
||||
|
||||
1) Verifying a pact between checkout-consumer and orders-producer - a request for order 42 has a matching body
|
||||
|
||||
1.1) body: $.total Expected '129.90' (String) to be a decimal number
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given order 999 does not exist
|
||||
a request for an unknown order
|
||||
returns a response which
|
||||
has status code 404 (OK)
|
||||
has a matching body (OK)
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given orders can be created
|
||||
a request to create an order
|
||||
returns a response which
|
||||
has status code 201 (OK)
|
||||
has a matching body (FAILED)
|
||||
|
||||
Failures:
|
||||
|
||||
1) Verifying a pact between checkout-consumer and orders-producer - a request to create an order has a matching body
|
||||
|
||||
1.1) body: $.total Expected '129.90' (String) to be a decimal number
|
||||
|
||||
[ERROR] Tests run: 3, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: N s <<< FAILURE! -- in com.ankurm.contracts.orders.OrdersPactVerificationTest
|
||||
[ERROR] com.ankurm.contracts.orders.OrdersPactVerificationTest.verifyPact(PactVerificationContext)[1] -- Time elapsed: N s <<< FAILURE!
|
||||
java.lang.AssertionError:
|
||||
checkout-consumer - Upon a request for order 42
|
||||
Failures:
|
||||
|
||||
1) Verifying a pact between checkout-consumer and orders-producer - a request for order 42 has a matching body
|
||||
|
||||
1.1) body: $.total Expected '129.90' (String) to be a decimal number
|
||||
|
||||
[ERROR] com.ankurm.contracts.orders.OrdersPactVerificationTest.verifyPact(PactVerificationContext)[3] -- Time elapsed: N s <<< FAILURE!
|
||||
java.lang.AssertionError:
|
||||
checkout-consumer - Upon a request to create an order
|
||||
Failures:
|
||||
|
||||
1) Verifying a pact between checkout-consumer and orders-producer - a request to create an order has a matching body
|
||||
|
||||
1.1) body: $.total Expected '129.90' (String) to be a decimal number
|
||||
|
||||
[ERROR] Failures:
|
||||
[ERROR] OrdersPactVerificationTest.verifyPact:43 checkout-consumer - Upon a request for order 42
|
||||
Failures:
|
||||
|
||||
1) Verifying a pact between checkout-consumer and orders-producer - a request for order 42 has a matching body
|
||||
|
||||
1.1) body: $.total Expected '129.90' (String) to be a decimal number
|
||||
|
||||
[ERROR] OrdersPactVerificationTest.verifyPact:43 checkout-consumer - Upon a request to create an order
|
||||
Failures:
|
||||
|
||||
1) Verifying a pact between checkout-consumer and orders-producer - a request to create an order has a matching body
|
||||
|
||||
1.1) body: $.total Expected '129.90' (String) to be a decimal number
|
||||
|
||||
[ERROR] Errors:
|
||||
[ERROR] OrdersTest.validate_shouldCreateOrder:40 ? IllegalState Parsed JSON [{"id":1001,"status":"NEW","total":"129.90","currency":"INR","items":[{"sku":"BOOK-1","qty":2}]}] doesn't match the JSON path [$[?(@.['total'] == 129.9)]]
|
||||
[ERROR] OrdersTest.validate_shouldReturnOrder:87 ? IllegalState Parsed JSON [{"id":42,"status":"CONFIRMED","total":"129.90","currency":"INR","items":[{"sku":"BOOK-1","qty":2}]}] doesn't match the JSON path [$[?(@.['total'] == 129.9)]]
|
||||
[ERROR] Tests run: 6, Failures: 2, Errors: 2, Skipped: 0
|
||||
[INFO] BUILD FAILURE
|
||||
@@ -0,0 +1,14 @@
|
||||
[INFO] Running com.ankurm.contracts.orders.OrdersTest
|
||||
|
||||
[ERROR] Tests run: 3, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: N s <<< FAILURE! -- in com.ankurm.contracts.orders.OrdersTest
|
||||
[ERROR] com.ankurm.contracts.orders.OrdersTest.validate_shouldReturnOrder -- Time elapsed: N s <<< ERROR!
|
||||
java.lang.NullPointerException
|
||||
|
||||
[ERROR] com.ankurm.contracts.orders.OrdersTest.validate_shouldReturn404ForUnknownOrder -- Time elapsed: N s <<< ERROR!
|
||||
java.lang.NullPointerException
|
||||
|
||||
[ERROR] Errors:
|
||||
[ERROR] OrdersTest.validate_shouldReturn404ForUnknownOrder:55 ? NullPointer
|
||||
[ERROR] OrdersTest.validate_shouldReturnOrder:76 ? NullPointer
|
||||
[ERROR] Tests run: 3, Failures: 0, Errors: 2, Skipped: 0
|
||||
[INFO] BUILD FAILURE
|
||||
@@ -0,0 +1,5 @@
|
||||
[INFO] Running com.ankurm.contracts.orders.OrdersTest
|
||||
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: N s -- in com.ankurm.contracts.orders.OrdersTest
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] BUILD SUCCESS
|
||||
@@ -0,0 +1,13 @@
|
||||
[INFO] Running com.ankurm.contracts.checkout.OrdersStubConsumerTest
|
||||
|
||||
[ERROR] Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: N s <<< FAILURE! -- in com.ankurm.contracts.checkout.OrdersStubConsumerTest
|
||||
[ERROR] com.ankurm.contracts.checkout.OrdersStubConsumerTest.amountDueComesFromTheStubbedOrder -- Time elapsed: N s <<< FAILURE!
|
||||
java.lang.AssertionError:
|
||||
|
||||
Expecting actual not to be null
|
||||
|
||||
[ERROR] Failures:
|
||||
[ERROR] OrdersStubConsumerTest.amountDueComesFromTheStubbedOrder:33
|
||||
Expecting actual not to be null
|
||||
[ERROR] Tests run: 3, Failures: 1, Errors: 0, Skipped: 0
|
||||
[INFO] BUILD FAILURE
|
||||
@@ -0,0 +1,32 @@
|
||||
[INFO] Using the model-based test generator [stubborn.contract.verifier.model-based-generator != false]
|
||||
[INFO] Running com.ankurm.contracts.orders.OrdersTest
|
||||
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: N s -- in com.ankurm.contracts.orders.OrdersTest
|
||||
[INFO] Running com.ankurm.contracts.orders.OrdersPactVerificationTest
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target-stubborn/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given order 42 exists and is confirmed
|
||||
a request for order 42
|
||||
returns a response which
|
||||
has status code 200 (OK)
|
||||
has a matching body (OK)
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target-stubborn/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given order 999 does not exist
|
||||
a request for an unknown order
|
||||
returns a response which
|
||||
has status code 404 (OK)
|
||||
has a matching body (OK)
|
||||
|
||||
Verifying a pact between checkout-consumer and orders-producer
|
||||
[Using File <repo>/contracts/orders-producer/target-stubborn/test-classes/pacts/checkout-consumer-orders-producer.json]
|
||||
Given orders can be created
|
||||
a request to create an order
|
||||
returns a response which
|
||||
has status code 201 (OK)
|
||||
has a matching body (OK)
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: N s -- in com.ankurm.contracts.orders.OrdersPactVerificationTest
|
||||
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] BUILD SUCCESS
|
||||
@@ -0,0 +1,5 @@
|
||||
[INFO] Running com.ankurm.contracts.checkout.OrdersStubbornConsumerTest
|
||||
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: N s -- in com.ankurm.contracts.checkout.OrdersStubbornConsumerTest
|
||||
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
|
||||
[INFO] BUILD SUCCESS
|
||||
Reference in New Issue
Block a user