HistogramAdapter implements MetricAdapter { @Override public void updateMonitorables() { samplingAdapter.updateMonitorables(); countingAdapter.updateMonitorables(); } HistogramAdapter(Histogram histogram, String name, String description, Unit<?> unit);  HistogramAdapter(Histogram histogram, String name, String description); @Override Set<Monitorable> getMonitorables(); @Override void updateMonitorables();  }
@Test public void shouldUpdateMedianMetric() { double newMedian = INITIAL_MEDIAN + 10; when(snapshot.getMedian()).thenReturn(newMedian); histogramAdapter.updateMonitorables(); assertThat(extractMonitorables(histogramAdapter).get(MEDIAN).get(), Matchers.<Object>is(newMedian)); }
@Test public void shouldUpdateStdDevMetric() { double newStdDev = INITIAL_STDDEV + 10; when(snapshot.getStdDev()).thenReturn(newStdDev); histogramAdapter.updateMonitorables(); assertThat(extractMonitorables(histogramAdapter).get(STDDEV).get(), Matchers.<Object>is(newStdDev)); }
@Test public void shouldUpdateCountMetric() { long newCount = INITIAL_COUNT + 10; when(histogram.getCount()).thenReturn(newCount); histogramAdapter.updateMonitorables(); assertThat(extractMonitorables(histogramAdapter).get(COUNT).get(), Matchers.<Object>is(newCount)); }
@Test public void shouldUpdateMinMetric() { long newMin = INITIAL_MIN + 10; when(snapshot.getMin()).thenReturn(newMin); histogramAdapter.updateMonitorables(); assertThat(extractMonitorables(histogramAdapter).get(MIN).get(), Matchers.<Object>is(newMin)); }
@Test public void shouldUpdateMaxMetric() { long newMax = INITIAL_MAX + 10; when(snapshot.getMax()).thenReturn(newMax); histogramAdapter.updateMonitorables(); assertThat(extractMonitorables(histogramAdapter).get(MAX).get(), Matchers.<Object>is(newMax)); }
@Test public void shouldUpdateMeanMetric() { double newMean = INITIAL_MEAN + 10; when(snapshot.getMean()).thenReturn(newMean); histogramAdapter.updateMonitorables(); assertThat(extractMonitorables(histogramAdapter).get(MEAN).get(), Matchers.<Object>is(newMean)); }