@Test public void aTimedAnnotatedMethod() throws Exception { instance.doAThing(); final Metric metric = registry.allMetrics().get(new MetricName(InstrumentedWithTimed.class, "things")); assertMetricSetup(metric); assertThat( "Guice creates a timer which records invocation length", ((TimerMetric) metric).count(), is(1L)); assertThat( "Guice creates a timer with the given rate unit", ((TimerMetric) metric).rateUnit(), is(TimeUnit.MINUTES)); assertThat( "Guice creates a timer with the given duration unit", ((TimerMetric) metric).durationUnit(), is(TimeUnit.MICROSECONDS)); }
@Test public void aTimedAnnotatedMethodWithProtectedScope() throws Exception { instance.doAThing(); final Metric metric = registry .allMetrics() .get(new MetricName(InstrumentedWithTimed.class, "doAThingWithProtectedScope")); assertMetricSetup(metric); }