### Question:
TimedMethodWithRegistryFromSharedMetricRegistries { @Timed(name = "singleTimedMethod") public void singleTimedMethod() { }  @Timed(name = "singleTimedMethod") void singleTimedMethod();  }### Answer:
@Test public void callTimedMethodOnce() { assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME)); MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME); assertThat("Timer is not registered correctly", registry.getTimers(), hasKey(TIMER_NAME)); Timer timer = registry.getTimers().get(TIMER_NAME); instance.singleTimedMethod(); assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(1L))); }