Search in sources :

Example 1 with ExchangeRateMonetarySummaryStatistics

use of org.javamoney.moneta.convert.ExchangeRateMonetarySummaryStatistics in project jsr354-ri-bp 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;
}
Also used : ExchangeRateMonetarySummaryStatistics(org.javamoney.moneta.convert.ExchangeRateMonetarySummaryStatistics) MonetarySummaryStatistics(org.javamoney.moneta.function.MonetarySummaryStatistics) DefaultMonetarySummaryStatistics(org.javamoney.moneta.function.DefaultMonetarySummaryStatistics) ExchangeRateMonetarySummaryStatistics(org.javamoney.moneta.convert.ExchangeRateMonetarySummaryStatistics)

Example 2 with ExchangeRateMonetarySummaryStatistics

use of org.javamoney.moneta.convert.ExchangeRateMonetarySummaryStatistics in project jsr354-ri-bp 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());
}
Also used : ExchangeRateMonetarySummaryStatistics(org.javamoney.moneta.convert.ExchangeRateMonetarySummaryStatistics) MonetarySummaryStatistics(org.javamoney.moneta.function.MonetarySummaryStatistics) DefaultMonetarySummaryStatistics(org.javamoney.moneta.function.DefaultMonetarySummaryStatistics) ExchangeRateMonetarySummaryStatistics(org.javamoney.moneta.convert.ExchangeRateMonetarySummaryStatistics) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Aggregations

ExchangeRateMonetarySummaryStatistics (org.javamoney.moneta.convert.ExchangeRateMonetarySummaryStatistics)2 DefaultMonetarySummaryStatistics (org.javamoney.moneta.function.DefaultMonetarySummaryStatistics)2 MonetarySummaryStatistics (org.javamoney.moneta.function.MonetarySummaryStatistics)2 BeforeTest (org.testng.annotations.BeforeTest)1 Test (org.testng.annotations.Test)1