You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to validate two xml messages, actual and expected with regex values, and I find DiffBuilder.compare() can't compare regex values. Please tell me how to fix it, thank you.
Expected text value '2020-02-14T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}\+08:00' but was '2020-02-14T07:18:57.347+08:00' - comparing <CreDtTm ...>2020-02-14T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}\+08:00</CreDtTm> at /Document[1]/CreDtTm[1]/text()[1] to <CreDtTm ...>2020-02-14T07:18:57.347+08:00</CreDtTm> at /Document[1]/CreDtTm[1]/text()[1]
The text was updated successfully, but these errors were encountered:
You are correct, XMLUnit does not do anything with regexes at all. It compares two documents, that's it.
If you want to implement regular expression based comparisons, DifferenceEvaluator is the interface to implement.
At first glance it looks as if it would fit into the placeholders project nicely, so rather than implementing a full DifferenceEvaluator one could implement a PlaceholderHandler that was triggered by ${xmlunit.matches(REGEX)} or something similar. It is not impossible that the placeholders API is not sufficient, though.
If you want to give it a shot and contribute the result back I'll be happy to assist.
Hi all,
I try to validate two xml messages, actual and expected with regex values, and I find DiffBuilder.compare() can't compare regex values. Please tell me how to fix it, thank you.
actual xml :
expected xml :
my code :
console output :
The text was updated successfully, but these errors were encountered: