From 49e45926969ea3a8ab118738a65bd2f75210db84 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 21 May 2022 19:21:25 +0200 Subject: [PATCH] WIP --- .../de/juplo/demos/pact/ContractTest.java | 6 +++ .../SpringConsumer-Siren Order Provider.json | 47 +++++++++++++++++++ 2 files changed, 53 insertions(+) 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" + } + ] + } + } } ] } -- 2.20.1