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

 

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Xmlunit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmlunit-general

Reply via email to