use of javax.money.convert.CurrencyConversion in project jsr354-ri by JavaMoney.
the class IMFRateProviderTest method shouldConvertsEuroToDollar.
@Test
public void shouldConvertsEuroToDollar() {
CurrencyConversion currencyConversion = provider.getCurrencyConversion(DOLLAR);
assertNotNull(currencyConversion);
MonetaryAmount money = Money.of(BigDecimal.TEN, EURO);
MonetaryAmount result = currencyConversion.apply(money);
assertEquals(result.getCurrency(), DOLLAR);
assertTrue(result.getNumber().doubleValue() > 0);
}
use of javax.money.convert.CurrencyConversion in project jsr354-ri by JavaMoney.
the class MonetaryConversionTest method testMonetaryConversionsECB.
@Test
public void testMonetaryConversionsECB() {
final MonetaryAmount amt = Money.of(2000, "EUR");
CurrencyConversion conv = MonetaryConversions.getConversion("CHF", "ECB");
MonetaryAmount converted = amt.with(conv);
assertNotNull(converted);
}
use of javax.money.convert.CurrencyConversion in project jsr354-ri by JavaMoney.
the class ECBCurrentRateProviderTest method shouldReturnsSameDollarValue.
@Test
public void shouldReturnsSameDollarValue() {
CurrencyConversion currencyConversion = provider.getCurrencyConversion(DOLLAR);
assertNotNull(currencyConversion);
MonetaryAmount money = Money.of(BigDecimal.TEN, DOLLAR);
MonetaryAmount result = currencyConversion.apply(money);
assertEquals(result.getCurrency(), DOLLAR);
assertEquals(result.getNumber().numberValue(BigDecimal.class), BigDecimal.TEN);
}
use of javax.money.convert.CurrencyConversion in project jsr354-ri by JavaMoney.
the class ECBCurrentRateProviderTest method shouldConvertsBrazilianToDollar.
@Test
public void shouldConvertsBrazilianToDollar() {
CurrencyConversion currencyConversion = provider.getCurrencyConversion(DOLLAR);
assertNotNull(currencyConversion);
MonetaryAmount money = Money.of(BigDecimal.TEN, BRAZILIAN_REAL);
MonetaryAmount result = currencyConversion.apply(money);
assertEquals(result.getCurrency(), DOLLAR);
assertTrue(result.getNumber().doubleValue() > 0);
}
use of javax.money.convert.CurrencyConversion in project jsr354-ri by JavaMoney.
the class ECBCurrentRateProviderTest method shouldConvertsDollarToBrazilian.
@Test
public void shouldConvertsDollarToBrazilian() {
CurrencyConversion currencyConversion = provider.getCurrencyConversion(BRAZILIAN_REAL);
assertNotNull(currencyConversion);
MonetaryAmount money = Money.of(BigDecimal.TEN, DOLLAR);
MonetaryAmount result = currencyConversion.apply(money);
assertEquals(result.getCurrency(), BRAZILIAN_REAL);
assertTrue(result.getNumber().doubleValue() > 0);
}
Aggregations