@Test public void aMeteredAnnotatedMethodWithDefaultScope() throws Exception { final Metric metric = registry .allMetrics() .get(new MetricName(InstrumentedWithMetered.class, "doAThingWithDefaultScope")); assertMetricIsSetup(metric); assertThat("Metric intialises to zero", ((Meter) metric).count(), is(0L)); instance.doAThingWithDefaultScope(); assertThat("Metric is marked", ((Meter) metric).count(), is(1L)); }
@Test public void aMeteredAnnotatedMethod() throws Exception { instance.doAThing(); final Metric metric = registry.allMetrics().get(new MetricName(InstrumentedWithMetered.class, "things")); assertMetricIsSetup(metric); assertThat("Guice creates a meter which gets marked", ((Meter) metric).count(), is(1L)); assertThat( "Guice creates a meter with the given event type", ((Meter) metric).eventType(), is("poops")); assertThat( "Guice creates a meter with the given rate unit", ((Meter) metric).rateUnit(), is(TimeUnit.MINUTES)); }