@Test(expectedExceptions = NullPointerException.class) public void shouldReturnErroWhenIsNull() { operator.apply(null); fail(); }
@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 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 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(); }
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); }
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);  }