@Test public void compareTo(){ final Amount testAmount = new Amount(999999999,99); final Amount lower = new Amount(999999999,98); assertEquals(+1, testAmount.compareTo(lower)); final Amount equal = new Amount(999999999,99); assertEquals(0, testAmount.compareTo(equal)); final Amount higher = new Amount(1000000000,00); assertEquals(-1, testAmount.compareTo(higher)); }
public int compareTo(final Amount other) { return Long.compare(cents, other.cents); }
Amount { public int compareTo(final Amount other) { return Long.compare(cents, other.cents); } }
Amount { public int compareTo(final Amount other) { return Long.compare(cents, other.cents); } @SuppressWarnings("unused") private  Amount();  Amount(final int euros, final int cents);  Amount(final double euros); }
Amount { public int compareTo(final Amount other) { return Long.compare(cents, other.cents); } @SuppressWarnings("unused") private  Amount();  Amount(final int euros, final int cents);  Amount(final double euros); static double maxValue(); static double minValue(); long getCents(); Amount plus(final Amount other); @Override boolean equals(final Object other); @Override int hashCode(); int compareTo(final Amount other); Amount minus(final Amount other); Amount times(final double factor); double toDouble(); String toString(); }
Amount { public int compareTo(final Amount other) { return Long.compare(cents, other.cents); } @SuppressWarnings("unused") private  Amount();  Amount(final int euros, final int cents);  Amount(final double euros); static double maxValue(); static double minValue(); long getCents(); Amount plus(final Amount other); @Override boolean equals(final Object other); @Override int hashCode(); int compareTo(final Amount other); Amount minus(final Amount other); Amount times(final double factor); double toDouble(); String toString(); static final Amount ZERO; }