@Test public void toStringWithSignAllwaysAddsASign() { assertThat(new Money(58, 92, EUR).toStringWithSign()).isEqualTo("+58.92 EUR"); assertThat(new Money(-60, USD).toStringWithSign()).isEqualTo("-0.60 USD"); assertThat(new Money(0, 0, "CHF").toStringWithSign()).isEqualTo("+0.00 CHF"); }
public String toStringWithSign() { final long absolute = absolute(); return (value < 0 ? "-" : "+") + absolute / 100 + "." + String.format("%02d", absolute % 100) + " " + currency.getCurrencyCode(); }
Money { public String toStringWithSign() { final long absolute = absolute(); return (value < 0 ? "-" : "+") + absolute / 100 + "." + String.format("%02d", absolute % 100) + " " + currency.getCurrencyCode(); } }
Money { public String toStringWithSign() { final long absolute = absolute(); return (value < 0 ? "-" : "+") + absolute / 100 + "." + String.format("%02d", absolute % 100) + " " + currency.getCurrencyCode(); } Money(final long rawValue, final Currency currency);  Money(final long rawValue, final String currencyCode);  Money(final long major, final int minor, final Currency currency);  Money(final long major, final int minor, final String currencyCode); }
Money { public String toStringWithSign() { final long absolute = absolute(); return (value < 0 ? "-" : "+") + absolute / 100 + "." + String.format("%02d", absolute % 100) + " " + currency.getCurrencyCode(); } Money(final long rawValue, final Currency currency);  Money(final long rawValue, final String currencyCode);  Money(final long major, final int minor, final Currency currency);  Money(final long major, final int minor, final String currencyCode); long asRawValue(); Currency getCurrency(); @Override boolean equals(final Object obj); @Override int hashCode(); String toStringWithSign(); @Override String toString(); }
Money { public String toStringWithSign() { final long absolute = absolute(); return (value < 0 ? "-" : "+") + absolute / 100 + "." + String.format("%02d", absolute % 100) + " " + currency.getCurrencyCode(); } Money(final long rawValue, final Currency currency);  Money(final long rawValue, final String currencyCode);  Money(final long major, final int minor, final Currency currency);  Money(final long major, final int minor, final String currencyCode); long asRawValue(); Currency getCurrency(); @Override boolean equals(final Object obj); @Override int hashCode(); String toStringWithSign(); @Override String toString();  }