String control = "<foo value=\"2.718281828\"/>";
String test = "<foo value=\"2.71\"/>";
Diff d = new Diff(control, test);
FloatingPointTolerantDifferenceListener c =
new FloatingPointTolerantDifferenceListener(new DifferenceListener() {
public int differenceFound(Difference d) {
fail("differenceFound shouldn't get invoked, but"
+ " was with type " + d.getId());
return -42;
}
public void skippedComparison(Node c, Node t) {
fail("skippedComparison shouldn't get invoked");
}
}, 1e-2);
d.overrideDifferenceListener(c);
assertTrue(d.identical());
c = new FloatingPointTolerantDifferenceListener(new DifferenceListener() {
public int differenceFound(Difference d) {
fail("differenceFound shouldn't get invoked, but"
+ " was with type " + d.getId());
return -42;
}