@Test public void toTest() { MonetarySummaryStatistics summary = createSummary(BRAZILIAN_REAL); MonetarySummaryStatistics summaryDollar = summary.to(DOLLAR); assertEquals(DOLLAR, summaryDollar.getCurrencyUnit()); assertEquals(3L, summaryDollar.getCount()); assertNotSame(0L, summaryDollar.getMin().getNumber().longValue()); assertNotSame(0L, summaryDollar.getMax().getNumber().longValue()); assertNotSame(0L, summaryDollar.getSum().getNumber().longValue()); assertNotSame(0L, summaryDollar.getAverage().getNumber().longValue()); }
@Override public MonetarySummaryStatistics to(CurrencyUnit unit) { CurrencyConversion currencyConversion = provider.getCurrencyConversion(unit); ExchangeRateMonetarySummaryStatistics another = new ExchangeRateMonetarySummaryStatistics( unit, provider); another.average = currencyConversion.apply(average); another.count = count; another.max = currencyConversion.apply(max); another.min = currencyConversion.apply(min); another.sum = currencyConversion.apply(sum); return another; }
ExchangeRateMonetarySummaryStatistics extends DefaultMonetarySummaryStatistics { @Override public MonetarySummaryStatistics to(CurrencyUnit unit) { CurrencyConversion currencyConversion = provider.getCurrencyConversion(unit); ExchangeRateMonetarySummaryStatistics another = new ExchangeRateMonetarySummaryStatistics( unit, provider); another.average = currencyConversion.apply(average); another.count = count; another.max = currencyConversion.apply(max); another.min = currencyConversion.apply(min); another.sum = currencyConversion.apply(sum); return another; } }
ExchangeRateMonetarySummaryStatistics extends DefaultMonetarySummaryStatistics { @Override public MonetarySummaryStatistics to(CurrencyUnit unit) { CurrencyConversion currencyConversion = provider.getCurrencyConversion(unit); ExchangeRateMonetarySummaryStatistics another = new ExchangeRateMonetarySummaryStatistics( unit, provider); another.average = currencyConversion.apply(average); another.count = count; another.max = currencyConversion.apply(max); another.min = currencyConversion.apply(min); another.sum = currencyConversion.apply(sum); return another; } ExchangeRateMonetarySummaryStatistics(CurrencyUnit currencyUnit,
			ExchangeRateProvider provider); }
ExchangeRateMonetarySummaryStatistics extends DefaultMonetarySummaryStatistics { @Override public MonetarySummaryStatistics to(CurrencyUnit unit) { CurrencyConversion currencyConversion = provider.getCurrencyConversion(unit); ExchangeRateMonetarySummaryStatistics another = new ExchangeRateMonetarySummaryStatistics( unit, provider); another.average = currencyConversion.apply(average); another.count = count; another.max = currencyConversion.apply(max); another.min = currencyConversion.apply(min); another.sum = currencyConversion.apply(sum); return another; } ExchangeRateMonetarySummaryStatistics(CurrencyUnit currencyUnit,
			ExchangeRateProvider provider); @Override void accept(MonetaryAmount amount); @Override MonetarySummaryStatistics combine(
			MonetarySummaryStatistics summaryStatistics); @Override boolean isExchangeable(); @Override MonetarySummaryStatistics to(CurrencyUnit unit); }
ExchangeRateMonetarySummaryStatistics extends DefaultMonetarySummaryStatistics { @Override public MonetarySummaryStatistics to(CurrencyUnit unit) { CurrencyConversion currencyConversion = provider.getCurrencyConversion(unit); ExchangeRateMonetarySummaryStatistics another = new ExchangeRateMonetarySummaryStatistics( unit, provider); another.average = currencyConversion.apply(average); another.count = count; another.max = currencyConversion.apply(max); another.min = currencyConversion.apply(min); another.sum = currencyConversion.apply(sum); return another; } ExchangeRateMonetarySummaryStatistics(CurrencyUnit currencyUnit,
			ExchangeRateProvider provider); @Override void accept(MonetaryAmount amount); @Override MonetarySummaryStatistics combine(
			MonetarySummaryStatistics summaryStatistics); @Override boolean isExchangeable(); @Override MonetarySummaryStatistics to(CurrencyUnit unit);  }