Class TextDifferenceListenerBase

java.lang.Object
org.custommonkey.xmlunit.examples.TextDifferenceListenerBase
All Implemented Interfaces:
DifferenceListener
Direct Known Subclasses:
CaseInsensitiveDifferenceListener, FloatingPointTolerantDifferenceListener

public abstract class TextDifferenceListenerBase extends Object implements DifferenceListener
Base class that delegates all differences to another DifferenceListener.

Subclasses get a chance to hook into special methods that will be invoked for differences in textual values of attributes, CDATA sections, Text or comment nodes.

  • Constructor Details

    • TextDifferenceListenerBase

      protected TextDifferenceListenerBase(DifferenceListener delegateTo)
      Creates a new instance
      Parameters:
      delegateTo - the DifferenceListener to delegate to.
  • Method Details

    • differenceFound

      public int differenceFound(Difference difference)
      Delegates to the nested DifferenceListener unless the Difference is of type ATTR_VALUE_ID, CDATA_VALUE_ID, COMMENT_VALUE_ID or TEXT_VALUE_ID - for those special differences attributeDifference, cdataDifference, commentDifference or textDifference are invoked respectively.
      Specified by:
      differenceFound in interface DifferenceListener
      Parameters:
      difference - a Difference instance as defined in DifferenceConstants describing the cause of the difference and containing the detail of the nodes that differ
      Returns:
      int one of the RETURN_... constants describing how this difference was interpreted
    • attributeDifference

      protected int attributeDifference(Difference d)
      Delegates to textualDifference.
      Parameters:
      d - the difference
      Returns:
      int one of the RETURN_... constants describing how this difference was interpreted
    • cdataDifference

      protected int cdataDifference(Difference d)
      Delegates to textualDifference.
      Parameters:
      d - the difference
      Returns:
      int one of the RETURN_... constants describing how this difference was interpreted
    • commentDifference

      protected int commentDifference(Difference d)
      Delegates to textualDifference.
      Parameters:
      d - the difference
      Returns:
      int one of the RETURN_... constants describing how this difference was interpreted
    • textDifference

      protected int textDifference(Difference d)
      Delegates to textualDifference.
      Parameters:
      d - the difference
      Returns:
      int one of the RETURN_... constants describing how this difference was interpreted
    • textualDifference

      protected int textualDifference(Difference d)
      Delegates to the nested DifferenceListener.
      Parameters:
      d - the difference
      Returns:
      int one of the RETURN_... constants describing how this difference was interpreted
    • skippedComparison

      public void skippedComparison(Node control, Node test)
      Description copied from interface: DifferenceListener
      Receive notification that a comparison between 2 nodes has been skipped because the node types are not comparable by the DifferenceEngine
      Specified by:
      skippedComparison in interface DifferenceListener
      Parameters:
      control - the control node being compared
      test - the test node being compared
      See Also: