### Question:
MeteredMethodBean { @Metered(name = "meteredMethod") public void meteredMethod() { }  @Metered(name = "meteredMethod") void meteredMethod();  }### Answer:
@Test @InSequence(2) public void callMeteredMethodOnce() { assertThat("Meter is not registered correctly", registry.getMeters(), hasKey(METER_NAME)); Meter meter = registry.getMeters().get(METER_NAME); bean.meteredMethod(); assertThat("Timer count is incorrect", meter.getCount(), is(equalTo(METER_COUNT.incrementAndGet()))); }
@Test @InSequence(3) public void removeMeterFromRegistry() { assertThat("Meter is not registered correctly", registry.getMeters(), hasKey(METER_NAME)); Meter meter = registry.getMeters().get(METER_NAME); registry.remove(METER_NAME); try { bean.meteredMethod(); } catch (RuntimeException cause) { assertThat(cause, is(instanceOf(IllegalStateException.class))); assertThat(cause.getMessage(), is(equalTo("No meter with name [" + METER_NAME + "] found in registry [" + registry + "]"))); assertThat("Meter count is incorrect", meter.getCount(), is(equalTo(METER_COUNT.get()))); return; } fail("No exception has been re-thrown!"); }