Search in sources :

Example 6 with FastMoneyProducer

use of org.javamoney.moneta.function.FastMoneyProducer in project jsr354-ri-bp by JavaMoney.

the class MonetaryAmountDecimalFormatBuilderTest method shouldCreateSettingCurrencyUnit.

@Test
public void shouldCreateSettingCurrencyUnit() {
    CurrencyUnit currencyUnit = Monetary.getCurrency("BRL");
    MonetaryAmountDecimalFormat format = (MonetaryAmountDecimalFormat) MonetaryAmountDecimalFormatBuilder.newInstance().withProducer(new FastMoneyProducer()).withCurrencyUnit(currencyUnit).build();
    assertEquals(format.getCurrencyUnit(), currencyUnit);
    assertEquals(format.getProducer().getClass(), FastMoneyProducer.class);
    assertEquals(format.getDecimalFormat().getCurrency().getCurrencyCode(), format.getCurrencyUnit().getCurrencyCode());
}
Also used : CurrencyUnit(javax.money.CurrencyUnit) FastMoneyProducer(org.javamoney.moneta.function.FastMoneyProducer) Test(org.testng.annotations.Test)

Aggregations

FastMoneyProducer (org.javamoney.moneta.function.FastMoneyProducer)6 Test (org.testng.annotations.Test)4 CurrencyUnit (javax.money.CurrencyUnit)2 BeforeMethod (org.testng.annotations.BeforeMethod)2