_Description:_
We have pact-jvm-provider-junit_2.12 with version 3.6.14 and we used XmlBodyMatcher to match response values in our provider side and all the rules passed smothly :)
We tried to updated to pact-jvm-provider-junit (version 4.0.2) and we noticed that rules for fields that contained special characters like: ("[", "!", "*","]") fail to pass anymore.
_Example:_
<?xml version="1.0" encoding="UTF-8"?>
<providerService version="1.0">
<attribute1>
<newattribute>
<date month="11" year="2019"/>
<name><![CDATA[Surname Name]]></name>
</newattribute>
<newattribute2>
<countryCode>RO</countryCode>
<hiddenData>ABCD***************010101</hiddenData>
</newattribute2>
</attribute1>
</providerService>
"$.providerService.attribute1.newattribute.name":{
"matchers": [
{
"match": "equality"
}
],
"combine": "AND"
},
},
"$.body.providerService.attribute1.newattribute2.hiddenData": {
"matchers": [
{
"match": "equality"
}
],
"combine": "AND"
}
Error message:
java.lang.AssertionError:
0 - BodyComparisonResult(mismatches={$.providerService.attribute1.newattribute.name=[BodyMismatch(expected=[name: null], actual=[name: null], mismatch=Expected [name: null] to equal [name: null],
path=$.providerService.attribute1.newattribute.name, diff=null)],
$."$.body.providerService.attribute1.newattribute2.hiddenData=[BodyMismatch(expected=[hiddenData: null], actual=[hiddenData: null], mismatch=Expected [hiddenData: null] to equal [hiddenData: null],
path=$.body.providerService.attribute1.newattribute2.hiddenData, diff=null)]}, diff=[- <?xml version="1.0" encoding="UTF-8"?><providerService version="1.0"><attribute1><newattribute><date month="11" year="2019"/><name><![CDATA[Surname Name]]></name></newattribute><newattribute2>
<countryCode>RO</countryCode><hiddenData>ABCD***************010101</hiddenData></newattribute2></attribute1></providerService>, +])
at au.com.dius.pact.provider.junit.target.BaseTarget.getAssertionError(BaseTarget.kt:72)
at au.com.dius.pact.provider.junit.target.HttpTarget.testInteraction(HttpTarget.kt:80)
at au.com.dius.pact.provider.junit.InteractionRunner$interactionBlock$statement$1.evaluate(InteractionRunner.kt:208)
at au.com.dius.pact.provider.junit.RunStateChanges.evaluate(RunStateChanges.kt:20)
at au.com.dius.pact.provider.junit.InteractionRunner.run(InteractionRunner.kt:149)
at au.com.dius.pact.provider.junit.PactRunner.runChild(PactRunner.kt:137)
at au.com.dius.pact.provider.junit.PactRunner.runChild(PactRunner.kt:51)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Instead of match: equality I also tried with regex
"match": "regex",
"regex": "^.ABCD*[\\*]{15}010101.*$"
but I received same error message
4.0.3 has been released with this fix
Most helpful comment
4.0.3 has been released with this fix