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