Class FloatingPointTolerantDifferenceListener

java.lang.Object
org.custommonkey.xmlunit.examples.TextDifferenceListenerBase
org.custommonkey.xmlunit.examples.FloatingPointTolerantDifferenceListener
All Implemented Interfaces:
DifferenceListener

public class FloatingPointTolerantDifferenceListener extends TextDifferenceListenerBase
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.

  • Constructor Details

    • FloatingPointTolerantDifferenceListener

      public FloatingPointTolerantDifferenceListener(DifferenceListener delegateTo, double tolerance)
      Creates a new instance
      Parameters:
      delegateTo - the DifferenceListener to delegate to.
      tolerance - absolute tolerance value for numerical differences
  • Method Details