@Test public void combineTest() { MonetarySummaryStatistics summaryA = createSummary(BRAZILIAN_REAL); MonetarySummaryStatistics summaryB = createSummary(DOLLAR); MonetarySummaryStatistics result = summaryA.combine(summaryB); assertEquals(BRAZILIAN_REAL, result.getCurrencyUnit()); assertEquals(6L, result.getCount()); assertNotNull(result.getMin()); assertNotSame(110L, result.getMax().getNumber().longValue()); assertNotSame(210L, result.getSum().getNumber().longValue()); assertNotSame(70L, result.getAverage().getNumber().longValue()); }
@Override public MonetarySummaryStatistics combine( MonetarySummaryStatistics summaryStatistics) { if (isDifferentCurrency(Objects.requireNonNull(summaryStatistics) .getCurrencyUnit())) { return super.combine(convert(summaryStatistics)); } else { return super.combine(summaryStatistics); } }
ExchangeRateMonetarySummaryStatistics extends DefaultMonetarySummaryStatistics { @Override public MonetarySummaryStatistics combine( MonetarySummaryStatistics summaryStatistics) { if (isDifferentCurrency(Objects.requireNonNull(summaryStatistics) .getCurrencyUnit())) { return super.combine(convert(summaryStatistics)); } else { return super.combine(summaryStatistics); } } }
ExchangeRateMonetarySummaryStatistics extends DefaultMonetarySummaryStatistics { @Override public MonetarySummaryStatistics combine( MonetarySummaryStatistics summaryStatistics) { if (isDifferentCurrency(Objects.requireNonNull(summaryStatistics) .getCurrencyUnit())) { return super.combine(convert(summaryStatistics)); } else { return super.combine(summaryStatistics); } } ExchangeRateMonetarySummaryStatistics(CurrencyUnit currencyUnit,
			ExchangeRateProvider provider); }
ExchangeRateMonetarySummaryStatistics extends DefaultMonetarySummaryStatistics { @Override public MonetarySummaryStatistics combine( MonetarySummaryStatistics summaryStatistics) { if (isDifferentCurrency(Objects.requireNonNull(summaryStatistics) .getCurrencyUnit())) { return super.combine(convert(summaryStatistics)); } else { return super.combine(summaryStatistics); } } 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 combine( MonetarySummaryStatistics summaryStatistics) { if (isDifferentCurrency(Objects.requireNonNull(summaryStatistics) .getCurrencyUnit())) { return super.combine(convert(summaryStatistics)); } else { return super.combine(summaryStatistics); } } ExchangeRateMonetarySummaryStatistics(CurrencyUnit currencyUnit,
			ExchangeRateProvider provider); @Override void accept(MonetaryAmount amount); @Override MonetarySummaryStatistics combine(
			MonetarySummaryStatistics summaryStatistics); @Override boolean isExchangeable(); @Override MonetarySummaryStatistics to(CurrencyUnit unit);  }