@Test public void shouldReturnPositiveValue() { CurrencyUnit currency = Monetary.getCurrency("EUR"); MonetaryAmount money = Money.parse("EUR 2.35"); MonetaryAmount result = operator.apply(money); assertEquals(result.getCurrency(), currency); assertEquals(result.getNumber().doubleValue(), 0.0235); }
@Override public MonetaryAmount apply(MonetaryAmount amount) { Objects.requireNonNull(amount, "Amount required."); return amount.multiply(permilValue); }
PermilOperator implements MonetaryOperator { @Override public MonetaryAmount apply(MonetaryAmount amount) { Objects.requireNonNull(amount, "Amount required."); return amount.multiply(permilValue); } }
PermilOperator implements MonetaryOperator { @Override public MonetaryAmount apply(MonetaryAmount amount) { Objects.requireNonNull(amount, "Amount required."); return amount.multiply(permilValue); } PermilOperator(final BigDecimal decimal); }
PermilOperator implements MonetaryOperator { @Override public MonetaryAmount apply(MonetaryAmount amount) { Objects.requireNonNull(amount, "Amount required."); return amount.multiply(permilValue); } PermilOperator(final BigDecimal decimal); @Override MonetaryAmount apply(MonetaryAmount amount); @Override String toString(); }
PermilOperator implements MonetaryOperator { @Override public MonetaryAmount apply(MonetaryAmount amount) { Objects.requireNonNull(amount, "Amount required."); return amount.multiply(permilValue); } PermilOperator(final BigDecimal decimal); @Override MonetaryAmount apply(MonetaryAmount amount); @Override String toString();  }