SF.net SVN: xmlunit: [150] trunk/xmlunit/tests/java/org/custommonkey/
xmlunit/test_DetailedDiff.java
From: <bo...@us...> - 2007-03-22 17:11:12
|
Revision: 150 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=150&view=rev Author: bodewig Date: 2007-03-22 10:11:11 -0700 (Thu, 22 Mar 2007) Log Message: ----------- Test for issue 1683752 Modified Paths: -------------- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java Modified: trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java =================================================================== --- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java 2007-03-22 05:02:09 UTC (rev 149) +++ trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java 2007-03-22 17:11:11 UTC (rev 150) @@ -165,6 +165,33 @@ } } + + public void testSeeAllDifferencesEvenIfDiffWouldSayHaltComparison() throws Exception { + String control = "<a><b/><c/></a>"; + String test = "<a><c/></a>"; + + Diff d = new Diff(control, test); + DetailedDiff dd = new DetailedDiff(d); + + List l = dd.getAllDifferences(); + // number of children is different, didn't find <b/>, wrong + // sequence of nodes + assertEquals(3, l.size()); + } + + public void XtestSeeAllDifferencesEvenIfDiffSaysHaltComparison() throws Exception { + String control = "<a><b/><c/></a>"; + String test = "<a><c/></a>"; + + Diff d = new Diff(control, test); + d.similar(); + DetailedDiff dd = new DetailedDiff(d); + + List l = dd.getAllDifferences(); + // number of children is different, didn't find <b/>, wrong + // sequence of nodes + assertEquals(3, l.size()); + } protected Diff buildDiff(Document control, Document test) { return new DetailedDiff(super.buildDiff(control, test)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
SF.net SVN: xmlunit: [154] trunk/xmlunit/tests/java/org/custommonkey/
xmlunit/test_DetailedDiff.java
From: <bo...@us...> - 2007-03-23 19:57:41
|
Revision: 154 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=154&view=rev Author: bodewig Date: 2007-03-23 12:57:40 -0700 (Fri, 23 Mar 2007) Log Message: ----------- add test for forum thread 1691528 Modified Paths: -------------- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java Modified: trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java =================================================================== --- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java 2007-03-23 04:49:34 UTC (rev 153) +++ trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java 2007-03-23 19:57:40 UTC (rev 154) @@ -192,7 +192,35 @@ // sequence of nodes assertEquals(3, l.size()); } + + /** + * @see http://sourceforge.net/forum/forum.php?thread_id=1691528&forum_id=73274 + */ + public void testHelpForumThread1691528() throws Exception { + String control = "<table border=\"1\">" + + "<tr>" + + "<th>News</th>" + + "</tr>" + + "<tr>" + + "<td>Newsitem 1</td>" + + "</tr>" + + "</table>"; + String test = "<table border=\"1\">" + + "<tr>" + + "<th>News</th>" + + "</tr>" + + "<tr>" + + "<td>Newsitem 2</td>" + + "<td>Newsitem 1</td>" + + "</tr>" + + "</table>"; + DetailedDiff diff = new DetailedDiff(new Diff(control, test)); + List changes = diff.getAllDifferences(); + // number of children, text of first child + assertEquals(2, changes.size()); + } + protected Diff buildDiff(Document control, Document test) { return new DetailedDiff(super.buildDiff(control, test)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
SF.net SVN: xmlunit: [236] trunk/xmlunit/tests/java/org/custommonkey/
xmlunit/test_DetailedDiff.java
From: <bo...@us...> - 2008-01-04 10:24:03
|
Revision: 236 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=236&view=rev Author: bodewig Date: 2008-01-04 02:24:02 -0800 (Fri, 04 Jan 2008) Log Message: ----------- add (disabled) test for bug 1860681 Modified Paths: -------------- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java Modified: trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java =================================================================== --- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java 2008-01-04 09:45:17 UTC (rev 235) +++ trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java 2008-01-04 10:24:02 UTC (rev 236) @@ -1,6 +1,6 @@ /* ****************************************************************** -Copyright (c) 2001-2007, Jeff Martin, Tim Bacon +Copyright (c) 2001-2008, Jeff Martin, Tim Bacon All rights reserved. Redistribution and use in source and binary forms, with or without @@ -42,6 +42,7 @@ import java.util.Iterator; import java.util.List; +import org.custommonkey.xmlunit.examples.MultiLevelElementNameAndTextQualifier; import org.w3c.dom.Document; import org.xml.sax.InputSource; @@ -243,6 +244,59 @@ assertEquals(3, changes.size()); } + /** + * Bug 1860681 + * @see https://sourceforge.net/tracker/index.php?func=detail&aid=1860681&group_id=23187&atid=377768 + */ + public void XtestXpathOfMissingNode() throws Exception { + String control = + "<books>" + + " <book>" + + " <title>Kabale und Liebe</title>" + + " </book>" + + " <book>" + + " <title>Schuld und Suehne</title>" + + " </book>" + + "</books>"; + String test = + "<books>" + + " <book>" + + " <title>Schuld und Suehne</title>" + + " </book>" + + "</books>"; + XMLUnit.setIgnoreWhitespace(true); + try { + Diff diff = new Diff(control, test); + diff.overrideElementQualifier(new MultiLevelElementNameAndTextQualifier(2)); + DetailedDiff dd = new DetailedDiff(diff); + List l = dd.getAllDifferences(); + assertEquals(3, l.size()); + // (0) number of children, (1) node not found, (2) order different + Difference d = (Difference) l.get(1); + assertEquals(DifferenceConstants.CHILD_NODE_NOT_FOUND_ID, + d.getId()); + assertEquals("/books[1]/book[1]", + d.getControlNodeDetail().getXpathLocation()); + assertNull(d.getTestNodeDetail().getXpathLocation()); + + // and reverse + diff = new Diff(test, control); + diff.overrideElementQualifier(new MultiLevelElementNameAndTextQualifier(2)); + dd = new DetailedDiff(diff); + l = dd.getAllDifferences(); + assertEquals(3, l.size()); + // (0) number of children, (1) order different, (2) node not found + d = (Difference) l.get(2); + assertEquals(DifferenceConstants.CHILD_NODE_NOT_FOUND_ID, + d.getId()); + assertEquals("/books[1]/book[1]", + d.getTestNodeDetail().getXpathLocation()); + assertNull(d.getControlNodeDetail().getXpathLocation()); + } finally { + XMLUnit.setIgnoreWhitespace(false); + } + } + protected Diff buildDiff(Document control, Document test) { return new DetailedDiff(super.buildDiff(control, test)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |