0

I'm using the xmlunit framework (i think version 1.0, or at least that's what the manifest of the .jar says).

What i'm doing is this:

Diff diff=new Diff(xml1,xml2);
diff.overrideElementQualifier(new ElementNameAndAttributeQualifier());
diff.overrideDifferenceListener(new MyCustomDifferenceListener()};

When i run the diff.identical() method with the Diff instantiated with (xml1,xml2) the breakpoint in MyCustomDifferenceListener.differenceFound(Difference difference) is hit twice, while for the other order it is hit 3 times.

The one relevant difference that is only hit in one case is (description): "Expected node type '3' but was '1' - comparing at /somenode[1]/element[1]/text()[1] to /somenode[1]/element[1]/child[196]"

The difference between the 2 xml files is one '\n' character after the last , before closing the (and then the root node).

Does anyone know why i'd only get the difference in one of the 2 cases?

P.S. I think the code is MyCustomDifferenceListener() was irrelevant, since it's not the one finding the differences.

vlad-ardelean
  • 7,480
  • 15
  • 80
  • 124
  • 1
    Have you tried to ignore white-space? `XMLUnit.setIgnoreWhitespace(true);` – Jiri Patera Apr 10 '12 at 08:58
  • Does the trick all right... it's just that, my biggest issue of concern is the lack of symmetry. I also seem to be getting that problem with other checks. – vlad-ardelean Apr 10 '12 at 10:26
  • If this really is XMLUnit 1.0 you've likely come across a bug that's been fixed for 1.1 when the `CHILD_NODE_NOT_FOUND_ID` difference was introduced. Experimenting with 1.6 right now consistently results in two differences either way. – Stefan Bodewig Feb 08 '15 at 10:39

0 Answers0