Class FloatingPointTolerantDifferenceListener
java.lang.Object
org.custommonkey.xmlunit.examples.TextDifferenceListenerBase
org.custommonkey.xmlunit.examples.FloatingPointTolerantDifferenceListener
- All Implemented Interfaces:
DifferenceListener
Expects texts to be floating point numbers and treats them as
identical if they only differ by a given tolerance value (or less).
This implementation uses an absolute tolerance value value for all numbers encountered, calculating a difference relative to one of the numbers compared might be more appropriate in general.
-
Field Summary
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
ConstructorDescriptionFloatingPointTolerantDifferenceListener
(DifferenceListener delegateTo, double tolerance) Creates a new instance -
Method Summary
Modifier and TypeMethodDescriptionprotected int
Delegates to the nested DifferenceListener.Methods inherited from class org.custommonkey.xmlunit.examples.TextDifferenceListenerBase
attributeDifference, cdataDifference, commentDifference, differenceFound, skippedComparison, textDifference
-
Constructor Details
-
FloatingPointTolerantDifferenceListener
Creates a new instance- Parameters:
delegateTo
- the DifferenceListener to delegate to.tolerance
- absolute tolerance value for numerical differences
-
-
Method Details
-
textualDifference
Description copied from class:TextDifferenceListenerBase
Delegates to the nested DifferenceListener.- Overrides:
textualDifference
in classTextDifferenceListenerBase
- Parameters:
d
- the difference- Returns:
- int one of the RETURN_... constants describing how this difference was interpreted
-