From: Oliver S. <oli...@gm...> - 2011-10-24 11:06:30
|
I'm trying to write a XMLUnitTest that compares to XMLDocuments that basically have to layers of elements, that can be out of order. <root> <table> <id>1</id> <row> <c>a</c > <c>b</c > </row> </table> <table> <id>2</id> <row> <c>b</c > <c>a</c > </row> </table> </root> So table can be out of order (with different id) and their corresponding row columns can be out of order. I think it boils down to these test cases: @Test public void testIdenticalAndSimilar() throws Exception { final String controlXML="<account><id>3A-00</id><name>acme</name></account>"; final String testXML="<account><name>acme</name><id>3A-00</id></account>"; final Diff diff=new Diff(controlXML, testXML); assertTrue(diff.similar()); } @Test public void testIdenticalAndSimilarWithNested() throws Exception { final String controlXML="<table><id>1</id><map><k>a</k><k>b</k></map></table>"; final String testXML="<table><id>1</id><map><k>b</k><k>a</k></map></table>"; final Diff diff=new Diff(controlXML, testXML); assertTrue(diff.similar()); } The second one should also pass but doesn't. Does anybody know a solution? Best regards Oliver Schrenk |