From: <bo...@us...> - 2013-08-13 11:45:10
|
Revision: 538 http://sourceforge.net/p/xmlunit/code/538 Author: bodewig Date: 2013-08-13 11:45:07 +0000 (Tue, 13 Aug 2013) Log Message: ----------- Bug#62 - indices in RecursiveElementNameAndTextQualifier swapped. Found by fnaeem Modified Paths: -------------- branches/xmlunit-1.x/src/java/org/custommonkey/xmlunit/examples/RecursiveElementNameAndTextQualifier.java branches/xmlunit-1.x/src/user-guide/XMLUnit-Java.xml branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/examples/test_RecursiveElementNameAndTextQualifier.java Modified: branches/xmlunit-1.x/src/java/org/custommonkey/xmlunit/examples/RecursiveElementNameAndTextQualifier.java =================================================================== --- branches/xmlunit-1.x/src/java/org/custommonkey/xmlunit/examples/RecursiveElementNameAndTextQualifier.java 2013-05-01 03:55:01 UTC (rev 537) +++ branches/xmlunit-1.x/src/java/org/custommonkey/xmlunit/examples/RecursiveElementNameAndTextQualifier.java 2013-08-13 11:45:07 UTC (rev 538) @@ -1,6 +1,6 @@ /* ****************************************************************** -Copyright (c) 2008, Jeff Martin, Tim Bacon +Copyright (c) 2008,2013 Jeff Martin, Tim Bacon All rights reserved. Redistribution and use in source and binary forms, with or without @@ -116,8 +116,8 @@ int i, j; for (i = j = 0; i < cNodes && j < tNodes; i++, j++) { - Node testNode = testNodes.item(i); - Node controlNode = controlNodes.item(j); + Node controlNode = controlNodes.item(i); + Node testNode = testNodes.item(j); // check if both node are same type if (controlNode.getNodeType() != testNode.getNodeType()) { Modified: branches/xmlunit-1.x/src/user-guide/XMLUnit-Java.xml =================================================================== --- branches/xmlunit-1.x/src/user-guide/XMLUnit-Java.xml 2013-05-01 03:55:01 UTC (rev 537) +++ branches/xmlunit-1.x/src/user-guide/XMLUnit-Java.xml 2013-08-13 11:45:07 UTC (rev 538) @@ -3730,6 +3730,11 @@ <itemizedlist> <listitem> + <literal>RecursiveElementNameAndTextQualifier</literal> had some indices + reversed leading to wrong results in some cases. + <ulink + href="https://sourceforge.net/p/xmlunit/bugs/62/">Issue + 62</ulink> </listitem> </itemizedlist> </section> Modified: branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/examples/test_RecursiveElementNameAndTextQualifier.java =================================================================== --- branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/examples/test_RecursiveElementNameAndTextQualifier.java 2013-05-01 03:55:01 UTC (rev 537) +++ branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/examples/test_RecursiveElementNameAndTextQualifier.java 2013-08-13 11:45:07 UTC (rev 538) @@ -1,6 +1,6 @@ /* ****************************************************************** -Copyright (c) 2008-2009, Jeff Martin, Tim Bacon +Copyright (c) 2008-2009,2013 Jeff Martin, Tim Bacon All rights reserved. Redistribution and use in source and binary forms, with or without @@ -167,6 +167,25 @@ assertTrue(d.toString(), d.similar()); } + /** + * @see "http://sourceforge.net/p/xmlunit/bugs/62/" + */ + public void testMultipleTextValuesWithAdditionalElement() throws Exception { + ElementQualifier qualifier = + new RecursiveElementNameAndTextQualifier(); + + Element control = document.createElement(TAG_NAME); + control.appendChild(document.createTextNode(TEXT_A)); + control.appendChild(document.createTextNode(TEXT_B)); + control.appendChild(document.createElement(TAG_NAME)); + + Element test = document.createElement(TAG_NAME); + test.appendChild(document.createTextNode(TEXT_A + TEXT_B)); + test.appendChild(document.createElement(TAG_NAME)); + assertTrue("denormalised control text comparable to normalised test text", + qualifier.qualifyForComparison(control, test)); + } + public void setUp() throws Exception { document = XMLUnit.newControlParser().newDocument(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |