|
From: Dubey, T. <Tar...@sa...> - 2009-12-15 06:18:18
|
Hi,
The following test case fails while according to the javadocs of
similar() method in Diff this should pass
@Test
public void testXmlIgnoreOrder() throws IOException, SAXException {
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
String xml1 =
"<TEST><FLIGHT NUM=\"121\"></FLIGHT><FLIGHT
NUM=\"122\"></FLIGHT></TEST>";
String xml2 =
"<TEST><FLIGHT NUM=\"122\"></FLIGHT><FLIGHT
NUM=\"121\"></FLIGHT></TEST>";
Diff diff = XMLUnit.compareXML(xml1, xml2);
Assert.assertTrue(diff.similar());
}
Surprisingly the same test passes if the element names are different as
shown below
@Test
public void testXmlIgnoreOrder() throws IOException, SAXException {
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
String xml1 =
"<TEST><FLIGHT NUM=\"121\"></FLIGHT><CRUISE
NUM=\"122\"></CRUISE></TEST>";
String xml2 =
"<TEST><CRUISE NUM=\"122\"></CRUISE><FLIGHT
NUM=\"121\"></FLIGHT></TEST>";
Diff diff = XMLUnit.compareXML(xml1, xml2);
Assert.assertTrue(diff.similar());
}
Is this bug already been reported ? If yes please can you let me know
where to find the fix or a workaround ?
Thanks
Tarun Dubey
|