Files
java-testing-lab/contracts/output/03-pact-file.json
T

167 lines
3.4 KiB
JSON

{
"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"
}
}