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:
Claude
2026-11-29 02:29:20 +05:30
parent d7497c8ab1
commit 8a429ca578
46 changed files with 1986 additions and 0 deletions
@@ -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