### Question:
Gauge extends Metric { Gauge(final MetricRegistry registry, final String id, final int maxCardinality) { super(registry, id, maxCardinality); } Gauge(final MetricRegistry registry, final String id, final int maxCardinality); void set(final long value, final String... tags);  }### Answer:
@Test public void testGauge() { MetricRegistry metricRegistry = new MetricRegistry(); Gauge g = metricRegistry.gauge("test"); new Expectations(g) {{ g.emit(anyLong, (String[]) any); }}; g.set(100L); new Verifications() {{ String[] tags; g.emit(100L, tags = withCapture()); assertEquals(0, tags.length); }}; g.set(-101L, "TEST-key", "test-value"); new Verifications() {{ String[] tags; g.emit(-101L, tags = withCapture()); assertThat(tags, arrayContaining("TEST-key", "test-value")); }}; }