use of javax.money.convert.ExchangeRateProvider in project jsr354-ri by JavaMoney.
the class ExchangeRateTypeTest method shouldReturnsECBCurrentRateProvider.
@Test
public void shouldReturnsECBCurrentRateProvider() {
ExchangeRateProvider prov = MonetaryConversions.getExchangeRateProvider(ExchangeRateType.ECB);
assertTrue(Objects.nonNull(prov));
assertEquals(ECBCurrentRateProvider.class, prov.getClass());
}
use of javax.money.convert.ExchangeRateProvider in project jsr354-ri by JavaMoney.
the class ProviderTest method testAccess_ECB.
@Test
public void testAccess_ECB() throws InterruptedException {
final MonetaryAmount inEuro = Money.of(10, "EUR");
for (int i = 0; i < 100; i++) {
try {
final ExchangeRateProvider rateProvider = MonetaryConversions.getExchangeRateProvider("ECB");
final CurrencyConversion dollarConversion = rateProvider.getCurrencyConversion("USD");
final MonetaryAmount inDollar = inEuro.with(dollarConversion);
System.out.println(String.format("RUN: %n - %s: %s ≙ %s", i, rateProvider, inEuro, inDollar));
} catch (Exception e) {
e.printStackTrace();
}
}
for (int i = 0; i < 100; i++) {
final ExchangeRateProvider rateProvider = MonetaryConversions.getExchangeRateProvider("ECB");
final CurrencyConversion dollarConversion = rateProvider.getCurrencyConversion("USD");
Thread.sleep(100L);
final MonetaryAmount inDollar = inEuro.with(dollarConversion);
System.out.println(String.format("RUN: %n - %s: %s ≙ %s", i, rateProvider, inEuro, inDollar));
}
}
use of javax.money.convert.ExchangeRateProvider in project jsr354-ri by JavaMoney.
the class ProviderTest method testAccess_HIST.
@Test
public void testAccess_HIST() throws InterruptedException {
final MonetaryAmount inEuro = Money.of(10, "EUR");
for (int i = 0; i < 100; i++) {
try {
final ExchangeRateProvider rateProvider = MonetaryConversions.getExchangeRateProvider("ECB-HIST");
final CurrencyConversion dollarConversion = rateProvider.getCurrencyConversion("USD");
final MonetaryAmount inDollar = inEuro.with(dollarConversion);
System.out.println(String.format("RUN: %n - %s: %s ≙ %s", i, rateProvider, inEuro, inDollar));
} catch (Exception e) {
e.printStackTrace();
}
}
for (int i = 0; i < 100; i++) {
final ExchangeRateProvider rateProvider = MonetaryConversions.getExchangeRateProvider("ECB-HIST");
final CurrencyConversion dollarConversion = rateProvider.getCurrencyConversion("USD");
Thread.sleep(100L);
final MonetaryAmount inDollar = inEuro.with(dollarConversion);
System.out.println(String.format("RUN: %n - %s: %s ≙ %s", i, rateProvider, inEuro, inDollar));
}
}
use of javax.money.convert.ExchangeRateProvider in project jsr354-ri by JavaMoney.
the class ExchangeRateTypeTest method shouldReturnsIMFHistoricRateProvider.
@Test
public void shouldReturnsIMFHistoricRateProvider() {
ExchangeRateProvider prov = MonetaryConversions.getExchangeRateProvider(ExchangeRateType.IMF_HIST);
assertTrue(Objects.nonNull(prov));
assertEquals(IMFHistoricRateProvider.class, prov.getClass());
}
use of javax.money.convert.ExchangeRateProvider in project jsr354-ri by JavaMoney.
the class ExchangeRateTypeTest method shouldReturnsIMFRateProvider.
@Test
public void shouldReturnsIMFRateProvider() {
ExchangeRateProvider prov = MonetaryConversions.getExchangeRateProvider(ExchangeRateType.IMF);
assertTrue(Objects.nonNull(prov));
assertEquals(IMFRateProvider.class, prov.getClass());
}
Aggregations