@Test public void shouldCreateMonetaryAmount() { MonetaryAmount monetaryAmount = factory.create(BigDecimal.TEN, real); assertNotNull(monetaryAmount); assertTrue(RoundedMoney.class.isInstance(monetaryAmount)); RoundedMoney roundedMoney = RoundedMoney.class.cast(monetaryAmount); assertEquals(real, roundedMoney.getCurrency()); assertEquals(BigDecimal.TEN, roundedMoney.getNumber().numberValue(BigDecimal.class)); }
@Override public MonetaryAmount create(Number number, CurrencyUnit currencyUnit) { return RoundedMoney.of(requireNonNull(number), requireNonNull(currencyUnit), roundingOperator); }
DefaultMonetaryRoundedFactory implements MonetaryRoundedFactory { @Override public MonetaryAmount create(Number number, CurrencyUnit currencyUnit) { return RoundedMoney.of(requireNonNull(number), requireNonNull(currencyUnit), roundingOperator); } }
DefaultMonetaryRoundedFactory implements MonetaryRoundedFactory { @Override public MonetaryAmount create(Number number, CurrencyUnit currencyUnit) { return RoundedMoney.of(requireNonNull(number), requireNonNull(currencyUnit), roundingOperator); } DefaultMonetaryRoundedFactory(MonetaryOperator roundingOperator); }
DefaultMonetaryRoundedFactory implements MonetaryRoundedFactory { @Override public MonetaryAmount create(Number number, CurrencyUnit currencyUnit) { return RoundedMoney.of(requireNonNull(number), requireNonNull(currencyUnit), roundingOperator); } DefaultMonetaryRoundedFactory(MonetaryOperator roundingOperator); @Override MonetaryAmount create(Number number, CurrencyUnit currencyUnit); @Override MonetaryOperator getRoundingOperator(); @Override String toString(); }
DefaultMonetaryRoundedFactory implements MonetaryRoundedFactory { @Override public MonetaryAmount create(Number number, CurrencyUnit currencyUnit) { return RoundedMoney.of(requireNonNull(number), requireNonNull(currencyUnit), roundingOperator); } DefaultMonetaryRoundedFactory(MonetaryOperator roundingOperator); @Override MonetaryAmount create(Number number, CurrencyUnit currencyUnit); @Override MonetaryOperator getRoundingOperator(); @Override String toString();  }