AverageAccumulator implements SimpleAccumulator<Double> { @Override public void add(Double value) { this.count++; this.localValue += value; }  @Override void add(Double value); void add(double value); void add(long value); void add(int value); @Override Double getLocalValue(); @Override void resetLocal(); @Override void merge(Accumulator<Double, Double> other); @Override AverageAccumulator clone(); @Override String toString();  }
@Test public void testAdd() { AverageAccumulator average = new AverageAccumulator(); int i1; for (i1 = 0; i1 < 10; i1++) { average.add(i1); } assertEquals(4.5, average.getLocalValue(), 0.0); average.resetLocal(); Integer i2; for (i2 = 0; i2 < 10; i2++) { average.add(i2); } assertEquals(4.5, average.getLocalValue(), 0.0); average.resetLocal(); long i3; for (i3 = 0; i3 < 10; i3++) { average.add(i3); } assertEquals(4.5, average.getLocalValue(), 0.0); average.resetLocal(); Long i4; for (i4 = 0L; i4 < 10; i4++) { average.add(i4); } assertEquals(4.5, average.getLocalValue(), 0.0); average.resetLocal(); double i5; for (i5 = 0; i5 < 10; i5++) { average.add(i5); } assertEquals(4.5, average.getLocalValue(), 0.0); average.resetLocal(); Double i6; for (i6 = 0.0; i6 < 10; i6++) { average.add(i6); } assertEquals(4.5, average.getLocalValue(), 0.0); average.resetLocal(); assertEquals(0.0, average.getLocalValue(), 0.0); }