MultipleMetricsMethodBean { @Counted(name = "counter") @Gauge(name = "gauge", unit = MetricUnits.NONE) @Metered(name = "meter") @Timed(name = "timer") public Long metricsMethod() { return 1234L; }  @Counted(name = "counter") @Gauge(name = "gauge", unit = MetricUnits.NONE) @Metered(name = "meter") @Timed(name = "timer") Long metricsMethod(); @Override String toString();  }
@Test @InSequence(2) public void callMetricsMethodOnce() { assertThat("Metrics are not registered correctly", registry.getMetricIDs(), is(equalTo(MetricsUtil.createMetricIDs(absoluteMetricNames())))); bean.metricsMethod(); assertThat("Counter count is incorrect", registry.getCounter( new MetricID(absoluteMetricName("counter"))).getCount(), is(equalTo(1L))); assertThat("Meter count is incorrect", registry.getMeter( new MetricID(absoluteMetricName("meter"))).getCount(), is(equalTo(1L))); assertThat("Timer count is incorrect", registry.getTimer( new MetricID(absoluteMetricName("timer"))).getCount(), is(equalTo(1L))); assertThat("Gauge value is incorrect", registry.getGauge( new MetricID(absoluteMetricName("gauge"))).getValue(), is(equalTo(1234L))); }