### Question:
AccumulatingMetricsScope extends EndingMetricsScope { @Override public void addData(String name, double value, StandardUnit unit) { addData(getKey(name), name, value, unit); }  @Override void addData(String name, double value, StandardUnit unit); @Override void addData(String name, double value, StandardUnit unit, MetricsLevel level); void addData(KeyType key, String name, double value, StandardUnit unit);  }### Answer:
@Test public void testSingleAdd() { TestScope scope = new TestScope(); scope.addData("name", 2.0, StandardUnit.COUNT); scope.assertMetrics(TestHelper.constructDatum("name", StandardUnit.COUNT, 2.0, 2.0, 2.0, 1)); }
@Test public void testAccumulate() { TestScope scope = new TestScope(); scope.addData("name", 2.0, StandardUnit.COUNT); scope.addData("name", 3.0, StandardUnit.COUNT); scope.assertMetrics(TestHelper.constructDatum("name", StandardUnit.COUNT, 3.0, 2.0, 5.0, 2)); }
@Test(expected = IllegalArgumentException.class) public void testAccumulateWrongUnit() { TestScope scope = new TestScope(); scope.addData("name", 2.0, StandardUnit.COUNT); scope.addData("name", 3.0, StandardUnit.MEGABITS); }