@Test public final void shouldValuesEqualsReturnCorrectValue() { Assert.assertTrue(BigDecimalUtils.valueEquals(null, null)); Assert.assertFalse(BigDecimalUtils.valueEquals(null, BigDecimal.ZERO)); Assert.assertFalse(BigDecimalUtils.valueEquals(BigDecimal.ZERO, null)); Assert.assertFalse(BigDecimalUtils.valueEquals(BigDecimal.ONE, BigDecimal.ZERO)); Assert.assertTrue(BigDecimalUtils.valueEquals(BigDecimal.ZERO.setScale(100), BigDecimal.ZERO.setScale(2))); }
public static boolean valueEquals(final BigDecimal d1, final BigDecimal d2) { if (d1 == null) { return d2 == null; } else if (d2 == null) { return false; } return d1.compareTo(d2) == 0; }
BigDecimalUtils { public static boolean valueEquals(final BigDecimal d1, final BigDecimal d2) { if (d1 == null) { return d2 == null; } else if (d2 == null) { return false; } return d1.compareTo(d2) == 0; } }
BigDecimalUtils { public static boolean valueEquals(final BigDecimal d1, final BigDecimal d2) { if (d1 == null) { return d2 == null; } else if (d2 == null) { return false; } return d1.compareTo(d2) == 0; } private  BigDecimalUtils(); }
BigDecimalUtils { public static boolean valueEquals(final BigDecimal d1, final BigDecimal d2) { if (d1 == null) { return d2 == null; } else if (d2 == null) { return false; } return d1.compareTo(d2) == 0; } private  BigDecimalUtils(); static BigDecimal convertNullToZero(final Object value); static BigDecimal convertNullToOne(final Object value); static BigDecimal toPercent(final BigDecimal decimalValue, final MathContext mathContext); static boolean valueEquals(final BigDecimal d1, final BigDecimal d2); static Either<Exception, Optional<BigDecimal>> tryParse(final String maybeStringWithDecimal, final Locale locale); static Either<Exception, Optional<BigDecimal>> tryParseAndIgnoreSeparator(final String maybeStringWithDecimal, final Locale locale); static boolean checkIfCorrectDecimalValue(final Entity entity, final String decimalFieldName); static String toString(BigDecimal decimal,int maximumFractionDigits); }
BigDecimalUtils { public static boolean valueEquals(final BigDecimal d1, final BigDecimal d2) { if (d1 == null) { return d2 == null; } else if (d2 == null) { return false; } return d1.compareTo(d2) == 0; } private  BigDecimalUtils(); static BigDecimal convertNullToZero(final Object value); static BigDecimal convertNullToOne(final Object value); static BigDecimal toPercent(final BigDecimal decimalValue, final MathContext mathContext); static boolean valueEquals(final BigDecimal d1, final BigDecimal d2); static Either<Exception, Optional<BigDecimal>> tryParse(final String maybeStringWithDecimal, final Locale locale); static Either<Exception, Optional<BigDecimal>> tryParseAndIgnoreSeparator(final String maybeStringWithDecimal, final Locale locale); static boolean checkIfCorrectDecimalValue(final Entity entity, final String decimalFieldName); static String toString(BigDecimal decimal,int maximumFractionDigits);  }