Search in sources :

Example 6 with RoundedMoney

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

the class DefaultMonetaryRoundedFactoryTest method shouldCreateMonetaryAmount.

@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));
}
Also used : MonetaryAmount(javax.money.MonetaryAmount) RoundedMoney(org.javamoney.moneta.RoundedMoney) BigDecimal(java.math.BigDecimal) Test(org.testng.annotations.Test)

Aggregations

BigDecimal (java.math.BigDecimal)6 RoundedMoney (org.javamoney.moneta.RoundedMoney)6 MonetaryAmount (javax.money.MonetaryAmount)2 Test (org.testng.annotations.Test)2