Update of /cvsroot/xdoclet/generama/src/main/java/org/generama/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv15320/src/main/java/org/generama/tests

Modified Files:
        AbstractXMLGeneratingPluginTestCase.java 
Log Message:
Now ignoring order of XML attributes and comments in XML comparison in test suite

Index: AbstractXMLGeneratingPluginTestCase.java
===================================================================
RCS file: 
/cvsroot/xdoclet/generama/src/main/java/org/generama/tests/AbstractXMLGeneratingPluginTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** AbstractXMLGeneratingPluginTestCase.java    20 Aug 2003 14:21:16 -0000      1.1
--- AbstractXMLGeneratingPluginTestCase.java    30 Aug 2003 17:33:06 -0000      1.2
***************
*** 4,8 ****
--- 4,11 ----
  import org.custommonkey.xmlunit.XMLTestCase;
  import org.custommonkey.xmlunit.XMLUnit;
+ import org.custommonkey.xmlunit.Diff;
+ import org.custommonkey.xmlunit.Difference;
  import org.xml.sax.SAXException;
+ import org.w3c.dom.Node;
  
  import javax.xml.parsers.ParserConfigurationException;
***************
*** 12,16 ****
  /**
   * Baseclass for testing generation of XML content. Ignores
!  * whitespace (but TODO not yet comments).
   * Uses XMLUnit internally to compare equality of XML documents.
   * 
--- 15,19 ----
  /**
   * Baseclass for testing generation of XML content. Ignores
!  * whitespace, ordering of attributes and comments.
   * Uses XMLUnit internally to compare equality of XML documents.
   * 
***************
*** 21,27 ****
  
      protected final void compare(Reader expected, Reader actual) throws 
ParserConfigurationException, IOException, SAXException {
          XMLUnit.setIgnoreWhitespace(true);
          XMLTestCase xmlunit = new XMLTestCase(this.getName());
!         xmlunit.assertXMLEqual(expected,actual);
      }
  }
--- 24,43 ----
  
      protected final void compare(Reader expected, Reader actual) throws 
ParserConfigurationException, IOException, SAXException {
+ 
          XMLUnit.setIgnoreWhitespace(true);
+         XMLUnit.getControlDocumentBuilderFactory().setIgnoringComments(true);
+         XMLUnit.getTestDocumentBuilderFactory().setIgnoringComments(true);
+ 
+         Diff diff = new Diff(expected, actual) {
+             public int differenceFound(String string, String string1, Node node, 
Node node1, Difference difference) {
+                 if("sequence of attributes".equals(difference.getDescription())) {
+                     return 0;
+                 }
+                 return super.differenceFound(string, string1, node, node1, 
difference);
+             }
+         };
          XMLTestCase xmlunit = new XMLTestCase(this.getName());
! 
!         xmlunit.assertXMLIdentical(diff, true);
      }
  }



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to