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

index 610957a..ad2835f 100644 (file)
@@ -40,7 +40,7 @@ public class ContractTest
               {
                 entities.eachLike(entity ->
                 {
-                  entity.arrayContaining("action", actionsArray->
+                  entity.arrayContaining("actions", actionsArray->
                   {
                     actionsArray.object(object ->
                     {
index ae1e66d..f04e0d3 100644 (file)
       },
       "response": {
         "body": {
-          "actions": [
-            {
-              "href": "http://localhost:8080/1234",
-              "method": "PUT",
-              "name": "update"
-            },
-            {
-              "href": "http://localhost:8080/1234",
-              "method": "DELETE",
-              "name": "delete"
-            }
-          ],
           "class": [
             "entity"
           ],
           "entities": [
-
+                        [
+              {
+                "action": [
+                  {
+                    "href": "http://localhost:8080/1234",
+                    "method": "PUT",
+                    "name": "update"
+                  },
+                  {
+                    "href": "http://localhost:8080/1234",
+                    "method": "DELETE",
+                    "name": "delete"
+                  }
+                ],
+                "class": [
+                  "entity"
+                ],
+                "links": [
+                  {
+                    "href": "http://localhost:8080/orders/RegexpMatcher(regex=\\d+, value=1234)",
+                    "rel": [
+                      "self"
+                    ]
+                  }
+                ],
+                "properties": {
+                  "id": "1234",
+                  "rel": [
+                    "item"
+                  ]
+                }
+              }
+            ]
           ],
           "links": [
             {
         },
         "generators": {
           "body": {
-            "$.links[0].href": {
-              "example": "http://localhost:8080/orders",
-              "regex": ".*\\/(\\Qorders\\E)$",
+            "$.entities[0].entities[*].links[0].href": {
+              "example": "http://localhost:8080/orders/RegexpMatcher(regex=\\d+, value=1234)",
+              "regex": ".*\\/(\\Qorders\\E\\/\\QRegexpMatcher(regex=\\d+, value=1234)\\E)$",
               "type": "MockServerURL"
             },
-            "$[0].href": {
+            "$.entities[0].entities[*][0].href": {
               "example": "http://localhost:8080/1234",
               "regex": ".*\\/(\\Q1234\\E)$",
               "type": "MockServerURL"
             },
-            "$[1].href": {
+            "$.entities[0].entities[*][1].href": {
               "example": "http://localhost:8080/1234",
               "regex": ".*\\/(\\Q1234\\E)$",
               "type": "MockServerURL"
+            },
+            "$.links[0].href": {
+              "example": "http://localhost:8080/orders",
+              "regex": ".*\\/(\\Qorders\\E)$",
+              "type": "MockServerURL"
             }
           }
         },
         },
         "matchingRules": {
           "body": {
-            "$.actions": {
+            "$.entities[0]": {
+              "combine": "AND",
+              "matchers": [
+                {
+                  "match": "type"
+                }
+              ]
+            },
+            "$.entities[0].entities[*].action": {
               "combine": "AND",
               "matchers": [
                 {
                 }
               ]
             },
+            "$.entities[0].entities[*].links[0].href": {
+              "combine": "AND",
+              "matchers": [
+                {
+                  "match": "regex",
+                  "regex": ".*\\/(\\Qorders\\E\\/\\QRegexpMatcher(regex=\\d+, value=1234)\\E)$"
+                }
+              ]
+            },
+            "$.entities[0].entities[*].properties.id": {
+              "combine": "AND",
+              "matchers": [
+                {
+                  "match": "type"
+                }
+              ]
+            },
             "$.links[0].href": {
               "combine": "AND",
               "matchers": [