Menu

overrideDifferenceListener

jm
2002-09-17
2002-09-18
  • jm

    jm - 2002-09-17

    HI,
    I am trying to use my own comparator, but i get an exception, and i have not seen any example code using overrideDifferenceListener in the source code.

    My code looks like this:

        FileReader resfiler = null;
        FileReader resfiler_exp = null;
    ...

        try {
            Diff diff = XMLUnit.compare(resfiler, resfiler_exp);
            diff.overrideDifferenceListener(new DifferenceWithoutDates());
            assertTrue("Different XML result", diff.identical());
            //        assertTrue("Different XML result", XMLUnit.compare(resfiler, resfiler_exp).identical());

    Is there anything wrong in that code?
    thanks

     
    • tim bacon

      tim bacon - 2002-09-17

      The code sample looks fine though without the stack trace you are getting it's hard to see what the cause of the problem might be. The class  IgnoreTextAndAttributeValuesDifferenceListener provides an example comparator (http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/xmlunit/xmlunit/src/java/org/custommonkey/xmlunit/IgnoreTextAndAttributeValuesDifferenceListener.java?rev=1.1&content-type=text/vnd.viewcvs-markup), and the junit test class for it (http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/xmlunit/xmlunit/tests/java/org/custommonkey/xmlunit/test_IgnoreTextAndAttributeValuesDifferenceListener.java?rev=1.1&content-type=text/vnd.viewcvs-markup) has an example of its usage.

      Hope this helps,

      Tim
      timbacon@users.sourceforge.net

       
    • jm

      jm - 2002-09-18

      Tim,

      I had coded my comparator looking at the example. Anyway, my code was not working properly, now it is, thanks.

       

Log in to post a comment.

MongoDB Logo MongoDB