diff --git a/src/main/java/com/github/tomakehurst/wiremock/matching/EqualToXmlPattern.java b/src/main/java/com/github/tomakehurst/wiremock/matching/EqualToXmlPattern.java index 2021c21a17..d1a6c850f2 100644 --- a/src/main/java/com/github/tomakehurst/wiremock/matching/EqualToXmlPattern.java +++ b/src/main/java/com/github/tomakehurst/wiremock/matching/EqualToXmlPattern.java @@ -60,7 +60,7 @@ public class EqualToXmlPattern extends StringValuePattern { private final Document expectedXmlDoc; public EqualToXmlPattern(@JsonProperty("equalToXml") String expectedValue) { - this(expectedValue, null, null, null, null, false); + this(expectedValue, null, null, null, null, null); } public EqualToXmlPattern( @@ -112,6 +112,10 @@ public Boolean isEnablePlaceholders() { return enablePlaceholders; } + public Boolean isIgnoreOrderOfSameNode() { + return ignoreOrderOfSameNode; + } + public String getPlaceholderOpeningDelimiterRegex() { return placeholderOpeningDelimiterRegex; } diff --git a/src/test/java/com/github/tomakehurst/wiremock/matching/EqualToXmlPatternTest.java b/src/test/java/com/github/tomakehurst/wiremock/matching/EqualToXmlPatternTest.java index ed0bfc7c5e..487db4d9d3 100644 --- a/src/test/java/com/github/tomakehurst/wiremock/matching/EqualToXmlPatternTest.java +++ b/src/test/java/com/github/tomakehurst/wiremock/matching/EqualToXmlPatternTest.java @@ -369,6 +369,7 @@ public void deserializesEqualToXmlWithMinimalParameters() { @Test public void deserializesEqualToXmlWithAllParameters() { Boolean enablePlaceholders = Boolean.TRUE; + Boolean ignoreOrderOfSameNode = Boolean.TRUE; String placeholderOpeningDelimiterRegex = "theOpeningDelimiterRegex"; String placeholderClosingDelimiterRegex = "theClosingDelimiterRegex"; String patternJson = @@ -377,6 +378,9 @@ public void deserializesEqualToXmlWithAllParameters() { + "\"enablePlaceholders\" : " + enablePlaceholders + ", " + + "\"ignoreOrderOfSameNode\" : " + + ignoreOrderOfSameNode + + ", " + "\"placeholderOpeningDelimiterRegex\" : \"" + placeholderOpeningDelimiterRegex + "\", " @@ -389,6 +393,7 @@ public void deserializesEqualToXmlWithAllParameters() { assertTrue(stringValuePattern instanceof EqualToXmlPattern); EqualToXmlPattern equalToXmlPattern = (EqualToXmlPattern) stringValuePattern; assertEquals(enablePlaceholders, equalToXmlPattern.isEnablePlaceholders()); + assertEquals(ignoreOrderOfSameNode, equalToXmlPattern.isIgnoreOrderOfSameNode()); assertEquals( placeholderOpeningDelimiterRegex, equalToXmlPattern.getPlaceholderOpeningDelimiterRegex()); assertEquals( @@ -402,6 +407,7 @@ public void deserializesEqualToXmlWithAllParameters() { public void serializesEqualToXmlWithAllParameters() { String xml = ""; Boolean enablePlaceholders = Boolean.TRUE; + Boolean ignoreOrderOfSameNode = Boolean.TRUE; String placeholderOpeningDelimiterRegex = "["; String placeholderClosingDelimiterRegex = "]"; @@ -412,7 +418,7 @@ public void serializesEqualToXmlWithAllParameters() { placeholderOpeningDelimiterRegex, placeholderClosingDelimiterRegex, Set.of(SCHEMA_LOCATION, NAMESPACE_URI, ATTR_VALUE), - false); + ignoreOrderOfSameNode); String json = Json.write(pattern); @@ -422,6 +428,7 @@ public void serializesEqualToXmlWithAllParameters() { "{\n" + " \"equalToXml\": \"\",\n" + " \"enablePlaceholders\": true,\n" + + " \"ignoreOrderOfSameNode\": true,\n" + " \"placeholderOpeningDelimiterRegex\": \"[\",\n" + " \"placeholderClosingDelimiterRegex\": \"]\",\n" + " \"exemptedComparisons\": [\"SCHEMA_LOCATION\", \"ATTR_VALUE\", \"NAMESPACE_URI\"]\n"