use of org.javamoney.moneta.function.MonetarySummaryStatistics in project jsr354-ri by JavaMoney.
the class ConversionAggregatorTest method groupBySummarizingMonetaryTest.
@Test
public void groupBySummarizingMonetaryTest() {
GroupMonetarySummaryStatistics group = currenciesToSummary().collect(groupBySummarizingMonetary());
Map<CurrencyUnit, MonetarySummaryStatistics> mapSummary = group.get();
assertEquals(mapSummary.keySet().size(), 3);
}
use of org.javamoney.moneta.function.MonetarySummaryStatistics in project jsr354-ri by JavaMoney.
the class ExchangeRateMonetarySummaryStatisticsTest method toTest.
@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());
}
use of org.javamoney.moneta.function.MonetarySummaryStatistics in project jsr354-ri by JavaMoney.
the class ExchangeRateMonetarySummaryStatisticsTest method createSummaryDefault.
private MonetarySummaryStatistics createSummaryDefault(CurrencyUnit currencyUnit) {
MonetarySummaryStatistics summary = DefaultMonetarySummaryStatistics.of(currencyUnit);
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 shouldConvertWhenIsDifferentCurrency.
@Test
public void shouldConvertWhenIsDifferentCurrency() {
MonetarySummaryStatistics summary = new ExchangeRateMonetarySummaryStatistics(BRAZILIAN_REAL, provider);
summary.accept(Money.of(10, DOLLAR));
assertEquals(BRAZILIAN_REAL, summary.getCurrencyUnit());
assertEquals(1L, summary.getCount());
assertNotSame(0L, summary.getMin().getNumber().longValue());
assertNotSame(0L, summary.getMax().getNumber().longValue());
assertNotSame(0L, summary.getSum().getNumber().longValue());
assertNotSame(0L, summary.getAverage().getNumber().longValue());
}
use of org.javamoney.moneta.function.MonetarySummaryStatistics in project jsr354-ri-bp by JavaMoney.
the class ExchangeRateMonetarySummaryStatisticsTest method createSummaryDefault.
private MonetarySummaryStatistics createSummaryDefault(CurrencyUnit currencyUnit) {
MonetarySummaryStatistics summary = DefaultMonetarySummaryStatistics.of(currencyUnit);
summary.accept(Money.of(10, currencyUnit));
summary.accept(Money.of(90, currencyUnit));
summary.accept(Money.of(110, currencyUnit));
return summary;
}
Aggregations