### Question:
EndingMetricsScope extends DimensionTrackingMetricsScope { @Override public void end() { if (ended) { throw new IllegalArgumentException("Cannot call IMetricsScope.end() more than once on the same instance"); } ended = true; }  @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(expected = IllegalArgumentException.class) public void testDoubleEnd() { TestScope scope = new TestScope(); scope.end(); scope.end(); }