### Question:
EndingMetricsScope extends DimensionTrackingMetricsScope { @Override public void addDimension(String name, String value) { super.addDimension(name, value); if (ended) { throw new IllegalArgumentException("Cannot call addDimension after calling IMetricsScope.end()"); } }  @Override void addData(String name, double value, StandardUnit unit); @Override void addData(String name, double value, StandardUnit unit, MetricsLevel level); @Override void addDimension(String name, String value); @Override void end();  }### Answer:
@Test public void testAddDimensionNotEnded() { TestScope scope = new TestScope(); scope.addDimension("foo", "bar"); }