@Test @InSequence(2) public void callExceptionMeteredMethodOnceWithThrowingExpectedException() { assertThat("Meters are not registered correctly", registry.getMeters().keySet(), is(equalTo(absoluteMetricNames()))); final RuntimeException exception = new IllegalArgumentException("message"); Runnable runnableThatThrowsIllegalArgumentException = new Runnable() { @Override public void run() { throw exception; } }; try { bean.illegalArgumentExceptionMeteredMethod(runnableThatThrowsIllegalArgumentException); fail("No exception has been re-thrown!"); } catch (RuntimeException cause) { assertThat("Meter count is incorrect", registry.getMeters().get(absoluteMetricName(0)).getCount(), is(equalTo(METER_COUNTS[0].incrementAndGet()))); assertThat("Meter count is incorrect", registry.getMeters().get(absoluteMetricName(1)).getCount(), is(equalTo(METER_COUNTS[1].get()))); assertSame("Exception thrown is incorrect", cause, exception); } }
@ExceptionMetered(name = "illegalArgumentExceptionMeteredMethod", cause = IllegalArgumentException.class) public void illegalArgumentExceptionMeteredMethod(Runnable runnable) { runnable.run(); }
ExceptionMeteredMethodBean { @ExceptionMetered(name = "illegalArgumentExceptionMeteredMethod", cause = IllegalArgumentException.class) public void illegalArgumentExceptionMeteredMethod(Runnable runnable) { runnable.run(); } }
ExceptionMeteredMethodBean { @ExceptionMetered(name = "illegalArgumentExceptionMeteredMethod", cause = IllegalArgumentException.class) public void illegalArgumentExceptionMeteredMethod(Runnable runnable) { runnable.run(); }  }
ExceptionMeteredMethodBean { @ExceptionMetered(name = "illegalArgumentExceptionMeteredMethod", cause = IllegalArgumentException.class) public void illegalArgumentExceptionMeteredMethod(Runnable runnable) { runnable.run(); }  @ExceptionMetered(name = "illegalArgumentExceptionMeteredMethod", cause = IllegalArgumentException.class) void illegalArgumentExceptionMeteredMethod(Runnable runnable); @ExceptionMetered(name = "exceptionMeteredMethod", cause = Exception.class) void exceptionMeteredMethod(Runnable runnable); }
ExceptionMeteredMethodBean { @ExceptionMetered(name = "illegalArgumentExceptionMeteredMethod", cause = IllegalArgumentException.class) public void illegalArgumentExceptionMeteredMethod(Runnable runnable) { runnable.run(); }  @ExceptionMetered(name = "illegalArgumentExceptionMeteredMethod", cause = IllegalArgumentException.class) void illegalArgumentExceptionMeteredMethod(Runnable runnable); @ExceptionMetered(name = "exceptionMeteredMethod", cause = Exception.class) void exceptionMeteredMethod(Runnable runnable);  }