@Test public void testConvertAmount() throws Exception { CurrencyUnit[] units = new CurrencyUnit[]{Monetary.getCurrency("CHF"), Monetary.getCurrency("EUR"), Monetary.getCurrency("USD"), Monetary.getCurrency("JPY"), Monetary.getCurrency("INR"),}; Money[] moneys = new Money[]{Money.of(10, "CHF"), Money.of(123.34, "USD"), Money.of(2300.30, "INR")}; long now = System.currentTimeMillis(); LocalDate[] times = new LocalDate[]{LocalDate.now(), LocalDate.now().minus(1, ChronoUnit.YEARS), LocalDate.now().minus(2, ChronoUnit.YEARS), LocalDate.now().minus(3, ChronoUnit.YEARS)}; for (CurrencyUnit u1 : units) { for (Money m : moneys) { for (LocalDate time : times) { boolean exception = false; MonetaryAmount expected = null; try { expected = m.with(MonetaryConversions.getConversion( ConversionQueryBuilder.of().set(time).setTermCurrency(u1).build())); } catch (Exception e) { exception = true; } MonetaryAmount res = conv.convertAmount(u1, m, time); try { assertEquals(expected, res); } catch (Exception e) { if (!exception) { throw e; } } } } } }
public MonetaryAmount convertAmount(CurrencyUnit tgt, MonetaryAmount amount, LocalDate timestamp) { throw new UnsupportedOperationException(); }
Conversions { public MonetaryAmount convertAmount(CurrencyUnit tgt, MonetaryAmount amount, LocalDate timestamp) { throw new UnsupportedOperationException(); } }
Conversions { public MonetaryAmount convertAmount(CurrencyUnit tgt, MonetaryAmount amount, LocalDate timestamp) { throw new UnsupportedOperationException(); }  }
Conversions { public MonetaryAmount convertAmount(CurrencyUnit tgt, MonetaryAmount amount, LocalDate timestamp) { throw new UnsupportedOperationException(); }  ExchangeRate getExchangeRateFromIMF(CurrencyUnit src, CurrencyUnit tgt); ExchangeRate getExchangeRateWithTime(CurrencyUnit src, CurrencyUnit tgt, LocalDate timestamp); MonetaryAmount convertAmountDefault(CurrencyUnit tgt, MonetaryAmount amount); ConversionContext getDefaultConversionContext(CurrencyUnit src, CurrencyUnit tgt); ProviderContext getIMFProviderContext(); ProviderContext getECBProviderContext(); ProviderContext getDefaultProviderContext(); MonetaryAmount convertAmount(CurrencyUnit tgt, MonetaryAmount amount, LocalDate timestamp); List<String> getDefaultProviderChain(); String getNewProviderName(); }
Conversions { public MonetaryAmount convertAmount(CurrencyUnit tgt, MonetaryAmount amount, LocalDate timestamp) { throw new UnsupportedOperationException(); }  ExchangeRate getExchangeRateFromIMF(CurrencyUnit src, CurrencyUnit tgt); ExchangeRate getExchangeRateWithTime(CurrencyUnit src, CurrencyUnit tgt, LocalDate timestamp); MonetaryAmount convertAmountDefault(CurrencyUnit tgt, MonetaryAmount amount); ConversionContext getDefaultConversionContext(CurrencyUnit src, CurrencyUnit tgt); ProviderContext getIMFProviderContext(); ProviderContext getECBProviderContext(); ProviderContext getDefaultProviderContext(); MonetaryAmount convertAmount(CurrencyUnit tgt, MonetaryAmount amount, LocalDate timestamp); List<String> getDefaultProviderChain(); String getNewProviderName();  }