Class TextDifferenceListenerBase
- java.lang.Object
-
- org.custommonkey.xmlunit.examples.TextDifferenceListenerBase
-
- All Implemented Interfaces:
DifferenceListener
- Direct Known Subclasses:
CaseInsensitiveDifferenceListener
,FloatingPointTolerantDifferenceListener
public abstract class TextDifferenceListenerBase extends java.lang.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.
-
-
Field Summary
Fields Modifier and Type Field Description private DifferenceListener
delegateTo
-
Fields inherited from interface org.custommonkey.xmlunit.DifferenceListener
RETURN_ACCEPT_DIFFERENCE, RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL, RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR, RETURN_UPGRADE_DIFFERENCE_NODES_DIFFERENT
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TextDifferenceListenerBase(DifferenceListener delegateTo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
attributeDifference(Difference d)
Delegates totextualDifference
.protected int
cdataDifference(Difference d)
Delegates totextualDifference
.protected int
commentDifference(Difference d)
Delegates totextualDifference
.int
differenceFound(Difference difference)
Delegates to the nested DifferenceListener unless the Difference is of typeATTR_VALUE_ID
,CDATA_VALUE_ID
,COMMENT_VALUE_ID
orTEXT_VALUE_ID
- for those special differencesattributeDifference
,cdataDifference
,commentDifference
ortextDifference
are invoked respectively.void
skippedComparison(org.w3c.dom.Node control, org.w3c.dom.Node test)
Receive notification that a comparison between 2 nodes has been skipped because the node types are not comparable by the DifferenceEngineprotected int
textDifference(Difference d)
Delegates totextualDifference
.protected int
textualDifference(Difference d)
Delegates to the nested DifferenceListener.
-
-
-
Field Detail
-
delegateTo
private final DifferenceListener delegateTo
-
-
Constructor Detail
-
TextDifferenceListenerBase
protected TextDifferenceListenerBase(DifferenceListener delegateTo)
-
-
Method Detail
-
differenceFound
public int differenceFound(Difference difference)
Delegates to the nested DifferenceListener unless the Difference is of typeATTR_VALUE_ID
,CDATA_VALUE_ID
,COMMENT_VALUE_ID
orTEXT_VALUE_ID
- for those special differencesattributeDifference
,cdataDifference
,commentDifference
ortextDifference
are invoked respectively.- Specified by:
differenceFound
in interfaceDifferenceListener
- Parameters:
difference
- a Difference instance as defined inDifferenceConstants
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 totextualDifference
.
-
cdataDifference
protected int cdataDifference(Difference d)
Delegates totextualDifference
.
-
commentDifference
protected int commentDifference(Difference d)
Delegates totextualDifference
.
-
textDifference
protected int textDifference(Difference d)
Delegates totextualDifference
.
-
textualDifference
protected int textualDifference(Difference d)
Delegates to the nested DifferenceListener.
-
skippedComparison
public void skippedComparison(org.w3c.dom.Node control, org.w3c.dom.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 interfaceDifferenceListener
- Parameters:
control
- the control node being comparedtest
- the test node being compared- See Also:
DifferenceEngine
-
-