@Test public void testIsZero() { Money[] moneys = new Money[]{Money.of(100, "CHF"), Money.of(34242344, "CHF"), Money.of(23123213.435, "CHF"), Money.of(-100, "CHF"), Money.of(-723527.36532, "CHF")}; for (Money m : moneys) { assertFalse(m.isZero()); } moneys = new Money[]{Money.of(0, "CHF"), Money.of(0.0, "CHF"), Money.of(BigDecimal.ZERO, "CHF"), Money.of(new BigDecimal("0.00000000000000000"), "CHF")}; for (Money m : moneys) { assertTrue(m.isZero()); } }
@Override public boolean isZero() { return signum() == 0; }
Money implements MonetaryAmount, Comparable<MonetaryAmount>, Serializable { @Override public boolean isZero() { return signum() == 0; } }
Money implements MonetaryAmount, Comparable<MonetaryAmount>, Serializable { @Override public boolean isZero() { return signum() == 0; } private  Money(BigDecimal number, CurrencyUnit currency); private  Money(BigDecimal number, CurrencyUnit currency, MonetaryContext monetaryContext); }
Money implements MonetaryAmount, Comparable<MonetaryAmount>, Serializable { @Override public boolean isZero() { return signum() == 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 isZero() { return signum() == 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; }