"varyRateNumOps", "java.lang.Integer", "test");
}
public void testMetricsMBeanBaseHistogram()
throws ReflectionException, AttributeNotFoundException, MBeanException {
MetricsRegistry mr = new MetricsRegistry();
MetricsHistogram histo = mock(MetricsHistogram.class);
Snapshot snap = mock(Snapshot.class);
//Set up the mocks
String histoName = "MockHisto";
when(histo.getName()).thenReturn(histoName);
when(histo.getCount()).thenReturn(20l);
when(histo.getMin()).thenReturn(1l);
when(histo.getMax()).thenReturn(999l);
when(histo.getMean()).thenReturn(500.2);
when(histo.getStdDev()).thenReturn(1.2);
when(histo.getSnapshot()).thenReturn(snap);
when(snap.getMedian()).thenReturn(490.0);
when(snap.get75thPercentile()).thenReturn(550.0);
when(snap.get95thPercentile()).thenReturn(900.0);
when(snap.get99thPercentile()).thenReturn(990.0);
mr.add("myTestHisto", histo);
MetricsMBeanBase mBeanBase = new MetricsMBeanBase(mr, "test");
assertEquals(new Long(20), mBeanBase
.getAttribute(histoName + MetricsHistogram.NUM_OPS_METRIC_NAME));