コード例 #1
0
 @Test
 public void multiple() {
   for (Integer i : ImmutableList.of(1, 4, -1, 3, 2)) {
     accumulator.accumulate(i.doubleValue());
   }
   assertThat(accumulator.result(), is(4d));
 }
コード例 #2
0
  @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));
  }
コード例 #3
0
 @Test(expected = IllegalStateException.class)
 public void none() {
   assertThat(accumulator.result(), is(0.0));
 }