@Test public void multiple() { for (Integer i : ImmutableList.of(1, 4, -1, 3, 2)) { accumulator.accumulate(i.doubleValue()); } assertThat(accumulator.result(), is(4d)); }
@Test public void overrideDefault() { assertThat(new DoubleMaxAccumulator(5.0).result(), is(5.0)); accumulator = new DoubleMaxAccumulator(1.0); accumulator.accumulate(2.1); assertThat(accumulator.result(), is(2.1)); }