@Test public void times(){ { final Amount amount = new Amount(1112223333,11); final Amount result = amount.times(3.0); assertEquals(3336669999.33, result.toDouble(), DELTA); } { final Amount amount = new Amount(100000,0); final Amount result = amount.times(-1.0); assertEquals(-100000.0, result.toDouble(), DELTA); } { final Amount max = new Amount(Amount.maxValue()); try{ max.times(1.00000000000001); fail("Amount.RangeExc expected"); }catch(Amount.RangeExc expected){} } { final Amount min = new Amount(Amount.minValue()); try{ min.times(1.00000000000001); fail("Amount.RangeExc expected"); }catch(Amount.RangeExc expected){} } }
public Amount times(final double factor) { final double result = this.toDouble() * factor; return new Amount(result); }
Amount { public Amount times(final double factor) { final double result = this.toDouble() * factor; return new Amount(result); } }
Amount { public Amount times(final double factor) { final double result = this.toDouble() * factor; return new Amount(result); } @SuppressWarnings("unused") private  Amount();  Amount(final int euros, final int cents);  Amount(final double euros); }
Amount { public Amount times(final double factor) { final double result = this.toDouble() * factor; 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 times(final double factor) { final double result = this.toDouble() * factor; 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; }