use of org.javamoney.moneta.function.MonetarySummaryStatistics in project jsr354-ri-bp by JavaMoney.
the class ExchangeRateMonetarySummaryStatisticsTest method combineTest.
@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());
}
use of org.javamoney.moneta.function.MonetarySummaryStatistics in project jsr354-ri by JavaMoney.
the class ConversionAggregatorTest method summarizingMonetaryExchangeTest.
@Test
public void summarizingMonetaryExchangeTest() {
MonetarySummaryStatistics summary = currenciesToSummary().collect(ConversionOperators.summarizingMonetary(BRAZILIAN_REAL, provider));
assertEquals(10L, summary.getCount());
}
use of org.javamoney.moneta.function.MonetarySummaryStatistics in project jsr354-ri by JavaMoney.
the class ExchangeRateMonetarySummaryStatisticsTest method combineImplSummaryTest.
@Test
public void combineImplSummaryTest() {
MonetarySummaryStatistics summaryA = createSummary(BRAZILIAN_REAL);
MonetarySummaryStatistics summaryB = createSummaryDefault(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());
}
use of org.javamoney.moneta.function.MonetarySummaryStatistics in project jsr354-ri by JavaMoney.
the class ExchangeRateMonetarySummaryStatisticsTest method createSummary.
private MonetarySummaryStatistics createSummary(CurrencyUnit currencyUnit) {
MonetarySummaryStatistics summary = new ExchangeRateMonetarySummaryStatistics(currencyUnit, provider);
summary.accept(Money.of(10, currencyUnit));
summary.accept(Money.of(90, currencyUnit));
summary.accept(Money.of(110, currencyUnit));
return summary;
}
use of org.javamoney.moneta.function.MonetarySummaryStatistics in project jsr354-ri by JavaMoney.
the class ExchangeRateMonetarySummaryStatisticsTest method combineTest.
@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());
}
Aggregations