StereotypeCountedClassBean { public void foo() { }  void foo();  }
@Test public void testPlainAnnotation() { MetricID constructorMetricId = new MetricID(StereotypeCountedClassBean.class.getName() + ".StereotypeCountedClassBean"); assertNotNull(metricRegistry.getCounter(constructorMetricId)); MetricID methodMetricId = new MetricID(StereotypeCountedClassBean.class.getName() + ".foo"); assertNotNull(metricRegistry.getCounter(methodMetricId)); bean.foo(); assertEquals(1, metricRegistry.getCounter(methodMetricId).getCount()); }
@Test public void testWithMetadata() { String constructorMetricName = "org.eclipse.microprofile.metrics.tck.cdi.stereotype.bloop.StereotypeCountedClassBeanWithSpecifiedMetadata"; MetricID constructorMetricId = new MetricID(constructorMetricName); assertNotNull(metricRegistry.getCounter(constructorMetricId)); Metadata constructorMetadata = metricRegistry.getMetadata(constructorMetricName); assertEquals("description", constructorMetadata.description().orElse(null)); assertEquals("displayName", constructorMetadata.getDisplayName()); String methodMetricName = "org.eclipse.microprofile.metrics.tck.cdi.stereotype.bloop.foo"; MetricID methodMetricId = new MetricID(methodMetricName); assertNotNull(metricRegistry.getCounter(methodMetricId)); Metadata methodMetadata = metricRegistry.getMetadata(methodMetricName); assertEquals("description", methodMetadata.description().orElse(null)); assertEquals("displayName", methodMetadata.getDisplayName()); beanWithSpecifiedMetadata.foo(); assertEquals(1, metricRegistry.getCounter(methodMetricId).getCount()); }