WIP
authorKai Moritz <kai@juplo.de>
Sat, 21 May 2022 17:21:25 +0000 (19:21 +0200)
committerKai Moritz <kai@juplo.de>
Sat, 21 May 2022 17:21:25 +0000 (19:21 +0200)
spring-consumer/src/test/java/de/juplo/demos/pact/ContractTest.java
spring-consumer/target/pacts/SpringConsumer-Siren Order Provider.json

index 91b8f65..95074a5 100644 (file)
@@ -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())
index ac6731a..dbc0978 100644 (file)
               "href": "http://localhost:8080/1234",
               "method": "PUT",
               "name": "update"
+            },
+            {
+              "href": "http://localhost:8080/1234",
+              "method": "DELETE",
+              "name": "delete"
             }
           ],
           "entities": [
               "example": "http://localhost:8080/1234",
               "regex": ".*\\/(\\Q1234\\E)$",
               "type": "MockServerURL"
+            },
+            "$[1].href": {
+              "example": "http://localhost:8080/1234",
+              "regex": ".*\\/(\\Q1234\\E)$",
+              "type": "MockServerURL"
             }
           }
         },
                           ]
                         }
                       }
+                    },
+                    {
+                      "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"
+                            }
+                          ]
+                        }
+                      }
                     }
                   ]
                 }