### Question:
Amount implements Comparable<Amount<T, U>> { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Amount)) { return false; } Amount<?, ?> other = (Amount<?, ?>) obj; return amount.equals(other.amount) || isSameAmount(other); } protected  Amount(T value, U unit, T maxValue); T getValue(); U getUnit(); T as(U unit); T asChecked(U unit); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); @Override int compareTo(Amount<T, U> other); static Amount<Double, U> of(double number, U unit); static Amount<Float, U> of(float number, U unit); static Amount<Long, U> of(long number, U unit); static Amount<Integer, U> of(int number, U unit);  }### Answer:
@Test public void testEquals() { assertEquals("expected value equality semantics", Amount.of(1L, Time.DAYS), Amount.of(1L, Time.DAYS)); assertEquals("expected equality to be calculated from amounts converted to a common unit", Amount.of(1L, Time.DAYS), Amount.of(24L, Time.HOURS)); assertNotEquals("expected unit conversions for equality tests to not lose precision", Amount.of(25L, Time.HOURS), Amount.of(1L, Time.DAYS)); assertNotEquals("expected unit conversions for equality tests to not lose precision", Amount.of(1L, Time.DAYS), Amount.of(25L, Time.HOURS)); assertFalse("expected value equality to work only for the same Number types", Amount.of(1L, Time.DAYS).equals(Amount.of(1.0, Time.DAYS))); assertFalse("expected value equality to work only for the same Number types", Amount.of(1L, Time.DAYS).equals(Amount.of(1, Time.DAYS))); assertFalse("amounts with incompatible units should never be equal even if their values are", Amount.of(1L, Time.NANOSECONDS).equals(Amount.of(1L, Data.BITS))); }