### Question:
ExtractorMinorPartOperator implements MonetaryOperator { @Override public MonetaryAmount apply(MonetaryAmount amount){ Objects.requireNonNull(amount, "Amount required."); BigDecimal number = amount.getNumber().numberValue(BigDecimal.class); BigDecimal wholes = number.setScale(0, RoundingMode.DOWN); return amount.subtract(amount.getFactory().setNumber(wholes).create()); } ExtractorMinorPartOperator(); @Override MonetaryAmount apply(MonetaryAmount amount);  }### Answer:
@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.35); }
@Test public void shouldReturnNegativeValue() { CurrencyUnit currency = Monetary.getCurrency("BHD"); MonetaryAmount money = Money.parse("BHD -1.345"); MonetaryAmount result = operator.apply(money); assertEquals(result.getCurrency(), currency); assertEquals(result.getNumber().doubleValue(), -0.345); }
@Test(expectedExceptions = NullPointerException.class) public void shouldReturnErroWhenIsNull() { operator.apply(null); fail(); }