@Test public void shouldReturnNegativeValue() { MonetaryAmount money = Money.parse("BHD -1.345"); MonetaryAmount result = operator.apply(money); assertEquals(result.getCurrency(), real); assertEquals(result.getNumber().doubleValue(), -1.345); }
@Override public MonetaryAmount apply(MonetaryAmount amount) { Objects.requireNonNull(amount, "Amount required."); return amount.getFactory().setCurrency(currency).create(); }
ExchangeCurrencyOperator implements MonetaryOperator { @Override public MonetaryAmount apply(MonetaryAmount amount) { Objects.requireNonNull(amount, "Amount required."); return amount.getFactory().setCurrency(currency).create(); } }
ExchangeCurrencyOperator implements MonetaryOperator { @Override public MonetaryAmount apply(MonetaryAmount amount) { Objects.requireNonNull(amount, "Amount required."); return amount.getFactory().setCurrency(currency).create(); } ExchangeCurrencyOperator(CurrencyUnit currency); }
ExchangeCurrencyOperator implements MonetaryOperator { @Override public MonetaryAmount apply(MonetaryAmount amount) { Objects.requireNonNull(amount, "Amount required."); return amount.getFactory().setCurrency(currency).create(); } ExchangeCurrencyOperator(CurrencyUnit currency); @Override MonetaryAmount apply(MonetaryAmount amount); }
ExchangeCurrencyOperator implements MonetaryOperator { @Override public MonetaryAmount apply(MonetaryAmount amount) { Objects.requireNonNull(amount, "Amount required."); return amount.getFactory().setCurrency(currency).create(); } ExchangeCurrencyOperator(CurrencyUnit currency); @Override MonetaryAmount apply(MonetaryAmount amount);  }