From: Kai Moritz Date: Sat, 21 May 2022 17:21:25 +0000 (+0200) Subject: WIP X-Git-Tag: wip-umbau-array-contains~3 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=49e45926969ea3a8ab118738a65bd2f75210db84;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 91b8f65..95074a5 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 @@ -42,6 +42,12 @@ public class ContractTest object.stringType("method", "PUT"); object.matchUrl2("href", Matchers.regexp("\\d+", "1234").getValue()); }); + actions.object(object -> + { + object.stringType("name","delete"); + object.stringType("method", "DELETE"); + object.matchUrl2("href", Matchers.regexp("\\d+", "1234").getValue()); + }); }); }); }).build()) diff --git a/spring-consumer/target/pacts/SpringConsumer-Siren Order Provider.json b/spring-consumer/target/pacts/SpringConsumer-Siren Order Provider.json index ac6731a..dbc0978 100644 --- a/spring-consumer/target/pacts/SpringConsumer-Siren Order Provider.json +++ b/spring-consumer/target/pacts/SpringConsumer-Siren Order Provider.json @@ -16,6 +16,11 @@ "href": "http://localhost:8080/1234", "method": "PUT", "name": "update" + }, + { + "href": "http://localhost:8080/1234", + "method": "DELETE", + "name": "delete" } ], "entities": [ @@ -28,6 +33,11 @@ "example": "http://localhost:8080/1234", "regex": ".*\\/(\\Q1234\\E)$", "type": "MockServerURL" + }, + "$[1].href": { + "example": "http://localhost:8080/1234", + "regex": ".*\\/(\\Q1234\\E)$", + "type": "MockServerURL" } } }, @@ -78,6 +88,43 @@ ] } } + }, + { + "generators": { + "$.href": { + "example": "http://localhost:8080/1234", + "regex": ".*\\/(\\Q1234\\E)$", + "type": "MockServerURL" + } + }, + "index": 1, + "rules": { + "$.href": { + "combine": "AND", + "matchers": [ + { + "match": "regex", + "regex": ".*\\/(\\Q1234\\E)$" + } + ] + }, + "$.method": { + "combine": "AND", + "matchers": [ + { + "match": "type" + } + ] + }, + "$.name": { + "combine": "AND", + "matchers": [ + { + "match": "type" + } + ] + } + } } ] }