### Question:
MeteredMethodWithExceptions { @ExceptionMetered(name = "exceptionMeteredMethod", cause = Exception.class) public void exceptionMeteredMethod(Runnable runnable) { runnable.run(); }  @ExceptionMetered(name = "illegalArgumentExceptionMeteredMethod", cause = IllegalArgumentException.class) void illegalArgumentExceptionMeteredMethod(Runnable runnable); @ExceptionMetered(name = "exceptionMeteredMethod", cause = Exception.class) void exceptionMeteredMethod(Runnable runnable);  }### Answer:
@Test public void callExceptionMeteredMethodOnceWithThrowingInstanceOfExpectedException() { assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME)); MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME); assertThat("Meters are not registered correctly", registry.getMeters().keySet(), is(equalTo(absoluteMetricNames()))); final RuntimeException exception = new IllegalStateException("message"); Runnable runnableThatThrowsIllegalStateException = new Runnable() { @Override public void run() { throw exception; } }; try { instance.exceptionMeteredMethod(runnableThatThrowsIllegalStateException); } catch (RuntimeException cause) { assertThat("Meter count is incorrect", registry.getMeters().get(absoluteMetricName(0)).getCount(), is(equalTo(0L))); assertThat("Meter count is incorrect", registry.getMeters().get(absoluteMetricName(1)).getCount(), is(equalTo(1L))); assertSame("Exception thrown is incorrect", cause, exception); return; } fail("No exception has been re-thrown!"); }