From bbff8e069b37597c062a39384c18f326ee2d0a7c Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 21 May 2022 17:36:11 +0200 Subject: [PATCH] WIP --- .../de/juplo/demos/pact/ContractTest.java | 4 +++ .../SpringConsumer-Siren Order Provider.json | 34 ++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/spring-consumer/src/test/java/de/juplo/demos/pact/ContractTest.java b/spring-consumer/src/test/java/de/juplo/demos/pact/ContractTest.java index 2e89474..c97432b 100644 --- a/spring-consumer/src/test/java/de/juplo/demos/pact/ContractTest.java +++ b/spring-consumer/src/test/java/de/juplo/demos/pact/ContractTest.java @@ -32,6 +32,10 @@ public class ContractTest .headers(Map.of("Content-Type", "application/vnd.siren+json")) .body(LambdaDsl.newJsonBody(body -> { + body.arrayContaining("actions", actions -> + { + actions.stringType("foo"); + }); }).build()) .toPact(); } diff --git a/spring-consumer/target/pacts/SpringConsumer-Siren Order Provider.json b/spring-consumer/target/pacts/SpringConsumer-Siren Order Provider.json index 323956d..d14b5d0 100644 --- a/spring-consumer/target/pacts/SpringConsumer-Siren Order Provider.json +++ b/spring-consumer/target/pacts/SpringConsumer-Siren Order Provider.json @@ -11,11 +11,43 @@ }, "response": { "body": { - + "actions": [ + "foo" + ] }, "headers": { "Content-Type": "application/vnd.siren+json" }, + "matchingRules": { + "body": { + "$.actions": { + "combine": "AND", + "matchers": [ + { + "match": "arrayContains", + "variants": [ + { + "generators": { + + }, + "index": 0, + "rules": { + "$": { + "combine": "AND", + "matchers": [ + { + "match": "type" + } + ] + } + } + } + ] + } + ] + } + } + }, "status": 200 } }, -- 2.20.1