CountingAdapter implements MetricAdapter { @Override public void updateMonitorables() { monitoredValue.set(counter.getCount()); } CountingAdapter(Counting counter, String name, String description, ValueSemantics valueSemantics); @Override Set<Monitorable> getMonitorables(); @Override void updateMonitorables();  }
@Test public void shouldUpdateMonitorValueWhenUpdateMonitorsIsCalled() { final long newValue = INITIAL_VALUE + 5; when(counter.getCount()).thenReturn(newValue); CountingAdapter countingAdapter = metricAdapter; countingAdapter.updateMonitorables(); assertThat(getFirstMonitorable(countingAdapter).get(), Matchers.<Object>is(newValue)); }