@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(), 2.0); }
@Override public MonetaryAmount apply(MonetaryAmount amount) { Objects.requireNonNull(amount, "Amount required."); return amount.with(DOWN_ROUNDING); }
ExtractorMajorPartOperator implements MonetaryOperator { @Override public MonetaryAmount apply(MonetaryAmount amount) { Objects.requireNonNull(amount, "Amount required."); return amount.with(DOWN_ROUNDING); } }
ExtractorMajorPartOperator implements MonetaryOperator { @Override public MonetaryAmount apply(MonetaryAmount amount) { Objects.requireNonNull(amount, "Amount required."); return amount.with(DOWN_ROUNDING); } ExtractorMajorPartOperator(); }
ExtractorMajorPartOperator implements MonetaryOperator { @Override public MonetaryAmount apply(MonetaryAmount amount) { Objects.requireNonNull(amount, "Amount required."); return amount.with(DOWN_ROUNDING); } ExtractorMajorPartOperator(); @Override MonetaryAmount apply(MonetaryAmount amount); }
ExtractorMajorPartOperator implements MonetaryOperator { @Override public MonetaryAmount apply(MonetaryAmount amount) { Objects.requireNonNull(amount, "Amount required."); return amount.with(DOWN_ROUNDING); } ExtractorMajorPartOperator(); @Override MonetaryAmount apply(MonetaryAmount amount);  }