### Question:
GaugeMethodWithRegistryFromString { public void setSingleGauge(long gauge) { this.singleGauge = gauge; }  @Gauge(name = "singleGaugeMethod") long getSingleGauge(); void setSingleGauge(long gauge);  }### Answer:
@Test public void callGaugeAfterSetterCall() { assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME)); MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME); assertThat("Gauge is not registered correctly", registry.getGauges(), hasKey(GAUGE_NAME)); @SuppressWarnings("unchecked") Gauge<Long> gauge = registry.getGauges().get(GAUGE_NAME); long value = Math.round(Math.random() * Long.MAX_VALUE); instance.setSingleGauge(value); assertThat("Gauge value is incorrect", gauge.getValue(), is(equalTo(value))); }