Money implements ValueObject { @Override public String toString() { String amountString; if (amount == 0) { amountString = "000"; } else { amountString = Integer.toString(amount); } return String.format("%s %s.%s", currency, amountString.substring(0, amountString.length() - 2), amountString.substring(amountString.length() - 2)); } @JsonCreator  Money(@NonNull @JsonProperty("currency") Currency currency, @JsonProperty("amount") int amount);  Money(@NonNull Currency currency, double amount); static Money valueOf(Currency currency, Integer value); @NonNull Money add(@NonNull Money augend); @NonNull Money subtract(@NonNull Money subtrahend); @NonNull Money multiply(int multiplicand); @NonNull Currency currency(); int fixedPointAmount(); double doubleAmount(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void toString_zero() { assertThat(new Money(Currency.SEK, 0).toString()).isEqualTo("SEK 0.00"); }
@Test public void toString_noZero() { assertThat(new Money(Currency.EUR, 212550).toString()).isEqualTo("EUR 2125.50"); }