@Test public void minus(){ { final Amount amount = new Amount(1112223334,99); final Amount result = amount.minus(new Amount(1102203304,66)); assertEquals(10020030.33, result.toDouble(), DELTA); } { final Amount amount = new Amount(100000,0); final Amount result = amount.minus(new Amount(0,1)); assertEquals(99999.99, result.toDouble(), DELTA); } { final Amount max = new Amount(Amount.maxValue()); final Amount badDelta = new Amount(0,-1); try{ max.minus(badDelta); fail("Amount.RangeExc expected"); }catch(Amount.RangeExc expected){} } { final Amount min = new Amount(Amount.minValue()); final Amount badDelta = new Amount(0,1); try{ min.minus(badDelta); fail("Amount.RangeExc expected"); }catch(Amount.RangeExc expected){} } }
public Amount minus(final Amount other) { final double result = this.toDouble() - other.toDouble(); return new Amount(result); }
Amount { public Amount minus(final Amount other) { final double result = this.toDouble() - other.toDouble(); return new Amount(result); } }
Amount { public Amount minus(final Amount other) { final double result = this.toDouble() - other.toDouble(); return new Amount(result); } @SuppressWarnings("unused") private  Amount();  Amount(final int euros, final int cents);  Amount(final double euros); }
Amount { public Amount minus(final Amount other) { final double result = this.toDouble() - other.toDouble(); return new Amount(result); } @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 Amount minus(final Amount other) { final double result = this.toDouble() - other.toDouble(); return new Amount(result); } @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; }