### Question:
AbsDiffNumberComparator implements Comparator<Number> { @Override public int compare(Number n1, Number n2) { BigDecimal bd1 = new BigDecimal(String.valueOf(n1)); BigDecimal bd2 = new BigDecimal(String.valueOf(n2)); return bd1.subtract(bd2).abs().compareTo(this.maxDiff) <= 0 ? 0 : bd1 .compareTo(bd2); } AbsDiffNumberComparator(int maxDiff);  AbsDiffNumberComparator(BigDecimal maxDiff); @Override int compare(Number n1, Number n2); @Override String toString();  }### Answer:
@Test public void testCompare_resultMustBeZero() { assertEquals(0, this.comparator.compare(zero, zero)); assertEquals(0, this.comparator.compare(p10, zero)); assertEquals(0, this.comparator.compare(zero, p10)); assertEquals(0, this.comparator.compare(n10, zero)); assertEquals(0, this.comparator.compare(zero, n10)); }
@Test public void testCompare_resultMustBeNonZero() { assertTrue(this.comparator.compare(p11, zero) > 0); assertTrue(this.comparator.compare(zero, p11) < 0); assertTrue(this.comparator.compare(n11, zero) < 0); assertTrue(this.comparator.compare(zero, n11) > 0); assertTrue(this.comparator.compare(maxVal, zero) > 0); assertTrue(this.comparator.compare(zero, maxVal) < 0); assertTrue(this.comparator.compare(minVal, zero) < 0); assertTrue(this.comparator.compare(zero, minVal) > 0); }