@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)); }
@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 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 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); }
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(); }
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();  }