From: Kai Moritz Date: Sat, 21 May 2022 15:36:11 +0000 (+0200) Subject: WIP X-Git-Tag: wip-umbau-array-contains~11 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=bbff8e069b37597c062a39384c18f326ee2d0a7c;p=demos%2Fexample-siren WIP --- 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 } },