Money extends Magnitude<Money> { @Override public boolean equals(final Object other) { if (this == other) { return true; } if (other == null) { return false; } return other.getClass() == this.getClass() && equals((Money) other); } Money(final double amount, final String currency);  Money(final long amount, final String currency); Money add(final Money money); double doubleValue(); float floatValue(); BigDecimal getAmount(); String getCurrency(); boolean hasSameCurrency(final Money money); int intValue(); @Override boolean isEqualTo(final Money magnitude); boolean isGreaterThanZero(); @Override boolean isLessThan(final Money magnitude); boolean isLessThanZero(); boolean isZero(); long longValue(); Money subtract(final Money money); @Override boolean equals(final Object other); boolean equals(final Money other); @Override int hashCode(); @Override String toString();  }
@Test public void testEqualsObject() { final Money m1 = new Money(100.25, "pds"); final Money m2 = new Money(100.25, "pds"); assertTrue(m1.equals(m2)); }
@Test public void testEqualsObjectFailsWithDifferentAmounts() { final Money m1 = new Money(100, "pds"); final Money m2 = new Money(101, "pds"); assertFalse(m1.equals(m2)); }
@Test public void testEqualsObjectFailsWithDifferentCurrencies() { final Money m1 = new Money(100, "pds"); final Money m2 = new Money(100, "usd"); assertFalse(m1.equals(m2)); }