Skip to content

Commit 362b15a

Browse files
author
Ronald Holshausen
committed
chore: update XML test cases from Pact-JVM
1 parent 7acc24b commit 362b15a

6 files changed

+10
-13
lines changed

testcases/request/body/array with at least one element matching by example xml.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"headers": {"Content-Type": "application/xml"},
99
"matchingRules": {
1010
"$.body.animals": {"min": 1, "match": "type"},
11-
"$.body.animals[0]": {"match": "type"},
12-
"$.body.animals[1]": {"match": "type"}
11+
"$.body.animals.alligator": {"match": "type"}
1312
},
1413
"body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><animals><alligator name=\"Fred\"/></animals>"
1514
},

testcases/request/body/array with regular expression in element xml.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
"headers": {"Content-Type": "application/xml"},
99
"matchingRules": {
1010
"$.body.animals": {"min": 1, "match": "type"},
11-
"$.body.animals[0]": {"match": "type"},
12-
"$.body.animals[1]": {"match": "type"},
13-
"$.body.animals[*]['@phoneNumber']": {"match": "regex", "regex": "\\d+"}
11+
"$.body.animals.alligator": {"match": "type"},
12+
"$.body.animals.alligator[*]['@phoneNumber']": {"match": "regex", "regex": "\\d+"}
1413
},
1514
"body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><animals><alligator phoneNumber=\"0415674567\"/></animals>"
1615
},

testcases/request/body/array with regular expression that does not match in element xml.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"$.body.animals": {"min": 1, "match": "type"},
1111
"$.body.animals.0": {"match": "type"},
1212
"$.body.animals.1": {"match": "type"},
13-
"$.body.animals[*].alligator['@phoneNumber']": {"match": "regex", "regex": "\\d+"}
13+
"$.body.animals.alligator['@phoneNumber']": {"match": "regex", "regex": "\\d+"}
1414
},
1515
"body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><animals><alligator phoneNumber=\"0415674567\"/></animals>"
1616
},

testcases/request/body/matches with regex xml.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"headers": {"Content-Type": "application/xml"},
99
"matchingRules": {
1010
"$.body.alligator['@name']": {"match": "regex", "regex": "\\w+"},
11-
"$.body.alligator[0].favouriteColours[0].favouriteColour": {"match": "regex", "regex": "red|blue"},
12-
"$.body.alligator[0].favouriteColours[1].favouriteColour": {"match": "regex", "regex": "red|blue"}
11+
"$.body.alligator.favouriteColours.favouriteColour": {"match": "regex", "regex": "red|blue"}
1312
},
1413
"body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><alligator name=\"Mary\" feet=\"4\"><favouriteColours><favouriteColour>red</favouriteColour><favouriteColour>blue</favouriteColour></favouriteColours></alligator>"
1514
},

testcases/response/body/array at top level with matchers xml.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
"headers": {"Content-Type": "application/xml"},
66
"body" : "<?xml version=\"1.0\" encoding=\"UTF-8\"?><people><person dob=\"06/10/2015\" name=\"Rogger the Dogger\" id=\"1014753708\" timestamp=\"2015-06-10T20:41:37\"/><cat dob=\"06/10/2015\" name=\"Cat in the Hat\" id=\"8858030303\" timestamp=\"2015-06-10T20:41:37\"/></people>",
77
"matchingRules" : {
8-
"$.body.people[*].*['@id']" : {
8+
"$.body.people.*['@id']" : {
99
"match" : "type"
1010
},
11-
"$.body.people[*].*['@name']" : {
11+
"$.body.people.*['@name']" : {
1212
"match" : "type"
1313
},
14-
"$.body.people[*].*['@dob']" : {
14+
"$.body.people.*['@dob']" : {
1515
"match": "regex", "regex" : "\\d{2}/\\d{2}/\\d{4}"
1616
},
17-
"$.body.people[*].*['@timestamp']" : {
17+
"$.body.people.*['@timestamp']" : {
1818
"match": "regex", "regex" : "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}"
1919
}
2020
}

testcases/response/body/array in different order xml.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"match": false,
2+
"match": true,
33
"comment": "XML Favourite colours in wrong order",
44
"expected" : {
55
"headers": {"Content-Type": "application/xml"},

0 commit comments

Comments
 (0)