use of javax.money.NumberValue in project jsr354-ri-bp by JavaMoney.
the class DefaultNumberValueTest method shouldReturnErrorWhenIntValueExactMustBeTruncated.
@Test(expectedExceptions = ArithmeticException.class)
public void shouldReturnErrorWhenIntValueExactMustBeTruncated() {
NumberValue numberValue = DefaultNumberValue.of(BigDecimal.valueOf(132.12));
numberValue.intValueExact();
}
use of javax.money.NumberValue in project jsr354-ri-bp by JavaMoney.
the class DefaultNumberValueTest method shouldReturnIntValueExact.
@Test
public void shouldReturnIntValueExact() {
NumberValue numberValue = DefaultNumberValue.of(BigDecimal.valueOf(132));
assertEquals(numberValue.intValueExact(), 132);
}
use of javax.money.NumberValue in project jsr354-ri-bp by JavaMoney.
the class DefaultNumberValueTest method shouldReturnLongValueExact.
@Test
public void shouldReturnLongValueExact() {
NumberValue numberValue = DefaultNumberValue.of(BigDecimal.valueOf(132));
assertEquals(numberValue.longValueExact(), 132L);
}
use of javax.money.NumberValue in project jsr354-ri-bp by JavaMoney.
the class DefaultNumberValueTest method shouldReturnErrorWhenLongValueExactMustBeTruncated.
@Test(expectedExceptions = ArithmeticException.class)
public void shouldReturnErrorWhenLongValueExactMustBeTruncated() {
NumberValue numberValue = DefaultNumberValue.of(BigDecimal.valueOf(132.12));
numberValue.longValueExact();
}
use of javax.money.NumberValue in project jsr354-ri-bp by JavaMoney.
the class DefaultNumberValueTest method shouldReturnAmountFractionDenominator.
@Test
public void shouldReturnAmountFractionDenominator() {
NumberValue numberValue = DefaultNumberValue.of(BigDecimal.valueOf(132.21));
assertEquals(100L, numberValue.getAmountFractionDenominator());
}
Aggregations