Search in sources :

Example 6 with MonetarySummaryStatistics

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

Example 7 with MonetarySummaryStatistics

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());
}
Also used : MonetarySummaryStatistics(org.javamoney.moneta.function.MonetarySummaryStatistics) GroupMonetarySummaryStatistics(org.javamoney.moneta.function.GroupMonetarySummaryStatistics) Test(org.testng.annotations.Test)

Example 8 with MonetarySummaryStatistics

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());
}
Also used : MonetarySummaryStatistics(org.javamoney.moneta.function.MonetarySummaryStatistics) DefaultMonetarySummaryStatistics(org.javamoney.moneta.function.DefaultMonetarySummaryStatistics) BeforeTest(org.testng.annotations.BeforeTest) Test(org.testng.annotations.Test)

Example 9 with MonetarySummaryStatistics

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;
}
Also used : MonetarySummaryStatistics(org.javamoney.moneta.function.MonetarySummaryStatistics) DefaultMonetarySummaryStatistics(org.javamoney.moneta.function.DefaultMonetarySummaryStatistics)

Example 10 with MonetarySummaryStatistics

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());
}
Also used : MonetarySummaryStatistics(org.javamoney.moneta.function.MonetarySummaryStatistics) DefaultMonetarySummaryStatistics(org.javamoney.moneta.function.DefaultMonetarySummaryStatistics) BeforeTest(org.testng.annotations.BeforeTest) Test(org.testng.annotations.Test)

Aggregations

MonetarySummaryStatistics (org.javamoney.moneta.function.MonetarySummaryStatistics)14 DefaultMonetarySummaryStatistics (org.javamoney.moneta.function.DefaultMonetarySummaryStatistics)12 Test (org.testng.annotations.Test)10 BeforeTest (org.testng.annotations.BeforeTest)8 ExchangeRateMonetarySummaryStatistics (org.javamoney.moneta.convert.ExchangeRateMonetarySummaryStatistics)6 GroupMonetarySummaryStatistics (org.javamoney.moneta.function.GroupMonetarySummaryStatistics)2 CurrencyUnit (javax.money.CurrencyUnit)1