[XOM-interest] XOMTestCase.compareChildren() should be insensitive to empty text nodes

Wolfgang Hoschek wolfgang.hoschek at mac.com
Thu Jan 25 19:16:29 EST 2007


XOMTestCase.compareChildren() compares two children for "equality".  
Ala XPath, it merges adjacent text nodes before doing so, which is  
fine, but the comparison isn't insensitive to empty text nodes, which  
seems wrong for all intents and purposes. The following test case  
should pass but currently fails:

     public void testEmptyTextComparison() {

         Element expected = new Element("foo");
         Element actual = new Element("foo");

         actual.appendChild(new Text(""));
         assertEquals("Comparison should be insensitive to empty text  
nodes", expected, actual);

         actual.appendChild(new Text(""));
         assertEquals("Comparison should be insensitive to empty text  
nodes", expected, actual);

         actual.appendChild(new Text(""));
         assertEquals("Comparison should be insensitive to empty text  
nodes", expected, actual);

         expected.appendChild(new Text(""));
         assertEquals("Comparison should be insensitive to empty text  
nodes", expected, actual);
     }




More information about the XOM-interest mailing list