/** Tests recording of custom times histograms. */ @SmallTest public void testRecordCustomTimesHistogram() { String histogram = "HelloWorld.CustomTimesMetric"; HistogramDelta zeroCount = new HistogramDelta(histogram, 0); HistogramDelta oneCount = new HistogramDelta(histogram, 1); HistogramDelta twoCount = new HistogramDelta(histogram, 100); assertEquals(0, zeroCount.getDelta()); assertEquals(0, oneCount.getDelta()); assertEquals(0, twoCount.getDelta()); TimeUnit milli = TimeUnit.MILLISECONDS; RecordHistogram.recordCustomTimesHistogram(histogram, 0, 1, 100, milli, 3); assertEquals(1, zeroCount.getDelta()); assertEquals(0, oneCount.getDelta()); assertEquals(0, twoCount.getDelta()); RecordHistogram.recordCustomTimesHistogram(histogram, 0, 1, 100, milli, 3); assertEquals(2, zeroCount.getDelta()); assertEquals(0, oneCount.getDelta()); assertEquals(0, twoCount.getDelta()); RecordHistogram.recordCustomTimesHistogram(histogram, 95, 1, 100, milli, 3); assertEquals(2, zeroCount.getDelta()); assertEquals(1, oneCount.getDelta()); assertEquals(0, twoCount.getDelta()); RecordHistogram.recordCustomTimesHistogram(histogram, 200, 1, 100, milli, 3); assertEquals(2, zeroCount.getDelta()); assertEquals(1, oneCount.getDelta()); assertEquals(1, twoCount.getDelta()); }