### Question:
TimedMethodBean { @Timed(name = "timedMethod") public void timedMethod() { }  @Timed(name = "timedMethod") void timedMethod(); void selfInvocationTimedMethod();  }### Answer:
@Test @InSequence(2) public void callTimedMethodOnce() { assertThat("Timer is not registered correctly", registry.getTimers(), hasKey(TIMER_NAME)); Timer timer = registry.getTimers().get(TIMER_NAME); bean.timedMethod(); assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(TIMER_COUNT.incrementAndGet()))); }
@Test @InSequence(4) public void removeTimerFromRegistry() { assertThat("Timer is not registered correctly", registry.getTimers(), hasKey(TIMER_NAME)); Timer timer = registry.getTimers().get(TIMER_NAME); registry.remove(TIMER_NAME); try { bean.timedMethod(); } catch (RuntimeException cause) { assertThat(cause, is(instanceOf(IllegalStateException.class))); assertThat(cause.getMessage(), is(equalTo("No timer with name [" + TIMER_NAME + "] found in registry [" + registry + "]"))); assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(TIMER_COUNT.get()))); return; } fail("No exception has been re-thrown!"); }