@Test public void aGaugeAnnotatedMethodWithAbsoluteName() throws Exception { instance.doAThingWithAbsoluteName(); final Gauge metric = registry.getGauges().get(name("absoluteName")); assertThat("Guice creates a metric", metric, is(notNullValue())); assertThat( "Guice creates a gauge with the given value", ((Gauge<String>) metric).getValue(), is("anotherThingWithAbsoluteName")); }
@Test public void aGaugeAnnotatedMethod() throws Exception { instance.doAThing(); final Gauge metric = registry.getGauges().get(name(InstrumentedWithGauge.class, "things")); assertThat("Guice creates a metric", metric, is(notNullValue())); assertThat( "Guice creates a gauge with the given value", ((Gauge<String>) metric).getValue(), is("poop")); }
@Test public void aGaugeAnnotatedMethodWithDefaultName() throws Exception { instance.doAnotherThing(); final Gauge metric = registry.getGauges().get(name(InstrumentedWithGauge.class, "doAnotherThing", GAUGE_SUFFIX)); assertThat("Guice creates a metric", metric, is(notNullValue())); assertThat( "Guice creates a gauge with the given value", ((Gauge<String>) metric).getValue(), is("anotherThing")); }