I'm comparing a generated XML file with another example using XMLunit, and Im having problems with ChildNodes Order and their attributes. (Linux and Mac generation differ)
This is what I've tried:
@Test
public void testComparingXML() throws Exception {
XMLUnit.setIgnoreWhitespace(true);
String expectedXml = IOUtils.toString(ConnectorStrategyStudioXmlTest.class.getClassLoader().getResourceAsStream(EXPECTED_XML));
String actualXml = IOUtils.toString(ConnectorStrategyStudioXmlTest.class.getClassLoader().getResourceAsStream(ACTUAL_XML));
Diff diff = new Diff(expectedXml, actualXml);
diff.overrideElementQualifier(new RecursiveElementNameAndTextQualifier());
DetailedDiff detailedDiff = new DetailedDiff(diff);
assertTrue(detailedDiff.toString(), detailedDiff.similar());
}
I've read that using RecursiveElementNameAndTextQualifier class could resolve the problem, but still doesn't work.
Here is an image with an example of the XML comparison failure:
(open in a new tab for full screen) c:
As you can see, both child nodes are inverted
TY in advance. Juan