@Test public void multiplyingWithMoneyShouldWork() { final Currency eur = Currency.getInstance("EUR"); final Currency usd = Currency.getInstance("USD"); assertThat(new Price(53059).multiply(new Volume(10, LOT), eur)).isEqualTo(new Money(530590, 0, eur)); assertThat(new Price(-5800).multiply(new Volume(9, NANO_LOT), usd)).isEqualTo(new Money(-52, 20, usd)); assertThat(new Price(5878).multiply(new Volume(1, NANO_LOT), eur)).isEqualTo(new Money(5, 87, eur)); assertThat(new Price(1000).multiply(new Volume(0, LOT), eur)).isEqualTo(new Money(0, eur)); assertThat(new Price(0).multiply(new Volume(10, LOT), usd)).isEqualTo(new Money(0, usd)); }
public Price multiply(final Ratio ratio) { return new Price(round(ratio.asBasic() * price)); }
Price implements Comparable<Price> { public Price multiply(final Ratio ratio) { return new Price(round(ratio.asBasic() * price)); } }
Price implements Comparable<Price> { public Price multiply(final Ratio ratio) { return new Price(round(ratio.asBasic() * price)); } Price(final double price);  Price(final long price);  Price(final long value, final PriceUnit unit); }
Price implements Comparable<Price> { public Price multiply(final Ratio ratio) { return new Price(round(ratio.asBasic() * price)); } Price(final double price);  Price(final long price);  Price(final long value, final PriceUnit unit); long asPipette(); double asDouble(); Price plus(final Price other); Price plus(final int amount, final PriceUnit unit); Price plus(final double value, final RatioUnit unit); Price plus(final Ratio ratio); Price minus(final Price other); Price minus(final int amount, final PriceUnit unit); Price minus(final double value, final RatioUnit unit); Price minus(final Ratio ratio); Price inverse(); Price absolute(); Price multiply(final Ratio ratio); Money multiply(final Volume volume, final Currency currency); Ratio divide(final Price divisor); boolean isLessThan(final Price other); boolean isGreaterThan(final Price other); boolean isStrongerThan(final Price other, final MarketDirection direction); boolean isWeakerThan(final Price other, final MarketDirection direction); boolean isBetweenInclusive(final Price a, final Price b); @Override boolean equals(final Object other); @Override int compareTo(final Price other); @Override int hashCode(); String toStringWithSign(); @Override String toString(); }
Price implements Comparable<Price> { public Price multiply(final Ratio ratio) { return new Price(round(ratio.asBasic() * price)); } Price(final double price);  Price(final long price);  Price(final long value, final PriceUnit unit); long asPipette(); double asDouble(); Price plus(final Price other); Price plus(final int amount, final PriceUnit unit); Price plus(final double value, final RatioUnit unit); Price plus(final Ratio ratio); Price minus(final Price other); Price minus(final int amount, final PriceUnit unit); Price minus(final double value, final RatioUnit unit); Price minus(final Ratio ratio); Price inverse(); Price absolute(); Price multiply(final Ratio ratio); Money multiply(final Volume volume, final Currency currency); Ratio divide(final Price divisor); boolean isLessThan(final Price other); boolean isGreaterThan(final Price other); boolean isStrongerThan(final Price other, final MarketDirection direction); boolean isWeakerThan(final Price other, final MarketDirection direction); boolean isBetweenInclusive(final Price a, final Price b); @Override boolean equals(final Object other); @Override int compareTo(final Price other); @Override int hashCode(); String toStringWithSign(); @Override String toString();  }