GaugeAdapter implements MetricAdapter { @Override public void updateMonitorables() { monitoredValue.set(theGauge.getValue()); } @SuppressWarnings("PMD.ExcessiveParameterList")  GaugeAdapter(Gauge<T> theGauge, String name, String description, Unit<?> unit, ValueSemantics valueSemantics); @Override Set<Monitorable> getMonitorables(); @Override void updateMonitorables();  }
@Test public void shouldUpdateMonitorToCurrentValueWhenUpdateMonitorsIsCalled() { int newValue = INITIAL_VALUE + 5; when(gauge.getValue()).thenReturn(newValue); gaugeAdapter.updateMonitorables(); assertThat((Integer)getFirstMonitorable(gaugeAdapter).get(), is(newValue)); }