Search in sources :

Example 11 with ConversionQuery

use of javax.money.convert.ConversionQuery in project jsr354-ri-bp by JavaMoney.

the class ECBHistoricRateProviderTest method shouldSetTimeInLocalDateTime.

@Test
public void shouldSetTimeInLocalDateTime() {
    Calendar localDate = new GregorianCalendar(2014, Calendar.JANUARY, 9);
    ConversionQuery conversionQuery = ConversionQueryBuilder.of().setTermCurrency(EURO).set(localDate).build();
    CurrencyConversion currencyConversion = provider.getCurrencyConversion(conversionQuery);
    assertNotNull(currencyConversion);
    MonetaryAmount money = Money.of(BigDecimal.TEN, DOLLAR);
    MonetaryAmount result = currencyConversion.apply(money);
    assertEquals(result.getCurrency(), EURO);
    assertTrue(result.getNumber().doubleValue() > 0);
}
Also used : ConversionQuery(javax.money.convert.ConversionQuery) MonetaryAmount(javax.money.MonetaryAmount) GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) CurrencyConversion(javax.money.convert.CurrencyConversion) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Aggregations

ConversionQuery (javax.money.convert.ConversionQuery)11 MonetaryAmount (javax.money.MonetaryAmount)10 CurrencyConversion (javax.money.convert.CurrencyConversion)10 BeforeTest (org.testng.annotations.BeforeTest)10 Test (org.testng.annotations.Test)10 LocalDate (java.time.LocalDate)9 Calendar (java.util.Calendar)2 GregorianCalendar (java.util.GregorianCalendar)2 InputStream (java.io.InputStream)1 MathContext (java.math.MathContext)1 DateTimeFormatter (java.time.format.DateTimeFormatter)1 Comparator (java.util.Comparator)1 Map (java.util.Map)1 Objects (java.util.Objects)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 TimeUnit (java.util.concurrent.TimeUnit)1 Level (java.util.logging.Level)1 Logger (java.util.logging.Logger)1 Collectors (java.util.stream.Collectors)1