@Test public void testIsGreaterThanOrEqualTo() { assertTrue( Money.of(BigDecimal.valueOf(0d), "CHF").isGreaterThanOrEqualTo(Money.of(BigDecimal.valueOf(0), "CHF"))); assertTrue(Money.of(BigDecimal.valueOf(0.00000000001d), "CHF") .isGreaterThanOrEqualTo(Money.of(BigDecimal.valueOf(0d), "CHF"))); assertTrue(Money.of(15, "CHF").isGreaterThanOrEqualTo(Money.of(10, "CHF"))); assertTrue(Money.of(15.546, "CHF").isGreaterThanOrEqualTo(Money.of(10.34, "CHF"))); assertFalse(Money.of(5, "CHF").isGreaterThanOrEqualTo(Money.of(10, "CHF"))); assertFalse(Money.of(5.546, "CHF").isGreaterThanOrEqualTo(Money.of(10.34, "CHF"))); }
@Override public boolean isGreaterThanOrEqualTo(MonetaryAmount amount) { MoneyUtils.checkAmountParameter(amount, this.currency); return number.stripTrailingZeros() .compareTo(amount.getNumber().numberValue(BigDecimal.class).stripTrailingZeros()) >= 0; }
Money implements MonetaryAmount, Comparable<MonetaryAmount>, Serializable { @Override public boolean isGreaterThanOrEqualTo(MonetaryAmount amount) { MoneyUtils.checkAmountParameter(amount, this.currency); return number.stripTrailingZeros() .compareTo(amount.getNumber().numberValue(BigDecimal.class).stripTrailingZeros()) >= 0; } }
Money implements MonetaryAmount, Comparable<MonetaryAmount>, Serializable { @Override public boolean isGreaterThanOrEqualTo(MonetaryAmount amount) { MoneyUtils.checkAmountParameter(amount, this.currency); return number.stripTrailingZeros() .compareTo(amount.getNumber().numberValue(BigDecimal.class).stripTrailingZeros()) >= 0; } private  Money(BigDecimal number, CurrencyUnit currency); private  Money(BigDecimal number, CurrencyUnit currency, MonetaryContext monetaryContext); }
Money implements MonetaryAmount, Comparable<MonetaryAmount>, Serializable { @Override public boolean isGreaterThanOrEqualTo(MonetaryAmount amount) { MoneyUtils.checkAmountParameter(amount, this.currency); return number.stripTrailingZeros() .compareTo(amount.getNumber().numberValue(BigDecimal.class).stripTrailingZeros()) >= 0; } private  Money(BigDecimal number, CurrencyUnit currency); private  Money(BigDecimal number, CurrencyUnit currency, MonetaryContext monetaryContext); @Override CurrencyUnit getCurrency(); @Override MonetaryContext getContext(); @Override NumberValue getNumber(); BigDecimal getNumberStripped(); @Override int compareTo(MonetaryAmount o); @Override Money abs(); @Override Money divide(long divisor); @Override Money divide(double divisor); @Override Money[] divideAndRemainder(long divisor); @Override Money[] divideAndRemainder(double divisor); @Override Money multiply(long multiplicand); @Override Money multiply(double multiplicand); @Override Money remainder(long divisor); @Override Money remainder(double divisor); @Override boolean isZero(); @Override boolean isPositive(); @Override boolean isPositiveOrZero(); @Override boolean isNegative(); @Override boolean isNegativeOrZero(); @Override R query(MonetaryQuery<R> query); @Override Money with(MonetaryOperator operator); @Override Money add(MonetaryAmount amount); @Override Money divide(Number divisor); @Override Money[] divideAndRemainder(Number divisor); @Override Money divideToIntegralValue(long divisor); @Override Money divideToIntegralValue(double divisor); @Override Money divideToIntegralValue(Number divisor); @Override Money multiply(Number multiplicand); @Override Money negate(); @Override Money plus(); @Override Money subtract(MonetaryAmount subtrahend); @Override Money stripTrailingZeros(); @Override Money remainder(Number divisor); @Override Money scaleByPowerOfTen(int power); @Override int signum(); @Override boolean isLessThan(MonetaryAmount amount); @Override boolean isLessThanOrEqualTo(MonetaryAmount amount); @Override boolean isGreaterThan(MonetaryAmount amount); @Override boolean isGreaterThanOrEqualTo(MonetaryAmount amount); @Override boolean isEqualTo(MonetaryAmount amount); @Override MonetaryAmountFactory<Money> getFactory(); @Override boolean equals(Object obj); @Override String toString(); @Override int hashCode(); static Money of(BigDecimal number, CurrencyUnit currency); static Money of(BigDecimal number, CurrencyUnit currency, MonetaryContext monetaryContext); static Money of(Number number, CurrencyUnit currency); static Money of(Number number, CurrencyUnit currency, MonetaryContext monetaryContext); static Money of(Number number, String currencyCode); static Money of(BigDecimal number, String currencyCode); static Money of(Number number, String currencyCode, MonetaryContext monetaryContext); static Money of(BigDecimal number, String currencyCode, MonetaryContext monetaryContext); static Money zero(CurrencyUnit currency); static Money ofMinor(CurrencyUnit currency, long amountMinor); static Money ofMinor(CurrencyUnit currency, long amountMinor, int fractionDigits); static Money from(MonetaryAmount amt); static Money parse(CharSequence text); static Money parse(CharSequence text, MonetaryAmountFormat formatter); @Deprecated static boolean isInfinityAndNotNaN(Number number); @Deprecated static void checkNoInfinityOrNaN(Number number); }
Money implements MonetaryAmount, Comparable<MonetaryAmount>, Serializable { @Override public boolean isGreaterThanOrEqualTo(MonetaryAmount amount) { MoneyUtils.checkAmountParameter(amount, this.currency); return number.stripTrailingZeros() .compareTo(amount.getNumber().numberValue(BigDecimal.class).stripTrailingZeros()) >= 0; } private  Money(BigDecimal number, CurrencyUnit currency); private  Money(BigDecimal number, CurrencyUnit currency, MonetaryContext monetaryContext); @Override CurrencyUnit getCurrency(); @Override MonetaryContext getContext(); @Override NumberValue getNumber(); BigDecimal getNumberStripped(); @Override int compareTo(MonetaryAmount o); @Override Money abs(); @Override Money divide(long divisor); @Override Money divide(double divisor); @Override Money[] divideAndRemainder(long divisor); @Override Money[] divideAndRemainder(double divisor); @Override Money multiply(long multiplicand); @Override Money multiply(double multiplicand); @Override Money remainder(long divisor); @Override Money remainder(double divisor); @Override boolean isZero(); @Override boolean isPositive(); @Override boolean isPositiveOrZero(); @Override boolean isNegative(); @Override boolean isNegativeOrZero(); @Override R query(MonetaryQuery<R> query); @Override Money with(MonetaryOperator operator); @Override Money add(MonetaryAmount amount); @Override Money divide(Number divisor); @Override Money[] divideAndRemainder(Number divisor); @Override Money divideToIntegralValue(long divisor); @Override Money divideToIntegralValue(double divisor); @Override Money divideToIntegralValue(Number divisor); @Override Money multiply(Number multiplicand); @Override Money negate(); @Override Money plus(); @Override Money subtract(MonetaryAmount subtrahend); @Override Money stripTrailingZeros(); @Override Money remainder(Number divisor); @Override Money scaleByPowerOfTen(int power); @Override int signum(); @Override boolean isLessThan(MonetaryAmount amount); @Override boolean isLessThanOrEqualTo(MonetaryAmount amount); @Override boolean isGreaterThan(MonetaryAmount amount); @Override boolean isGreaterThanOrEqualTo(MonetaryAmount amount); @Override boolean isEqualTo(MonetaryAmount amount); @Override MonetaryAmountFactory<Money> getFactory(); @Override boolean equals(Object obj); @Override String toString(); @Override int hashCode(); static Money of(BigDecimal number, CurrencyUnit currency); static Money of(BigDecimal number, CurrencyUnit currency, MonetaryContext monetaryContext); static Money of(Number number, CurrencyUnit currency); static Money of(Number number, CurrencyUnit currency, MonetaryContext monetaryContext); static Money of(Number number, String currencyCode); static Money of(BigDecimal number, String currencyCode); static Money of(Number number, String currencyCode, MonetaryContext monetaryContext); static Money of(BigDecimal number, String currencyCode, MonetaryContext monetaryContext); static Money zero(CurrencyUnit currency); static Money ofMinor(CurrencyUnit currency, long amountMinor); static Money ofMinor(CurrencyUnit currency, long amountMinor, int fractionDigits); static Money from(MonetaryAmount amt); static Money parse(CharSequence text); static Money parse(CharSequence text, MonetaryAmountFormat formatter); @Deprecated static boolean isInfinityAndNotNaN(Number number); @Deprecated static void checkNoInfinityOrNaN(Number number); static final MonetaryContext DEFAULT_MONETARY_CONTEXT; }