DoubleCounter extends AbstractMonitor<Number> implements NumericMonitor<Number>, SpectatorMonitor { @Override public Number getValue(int pollerIndex) { final long n = count.poll(pollerIndex); final double stepSeconds = Pollers.POLLING_INTERVALS[pollerIndex] / 1000.0; return Double.longBitsToDouble(n) / stepSeconds; } DoubleCounter(MonitorConfig config, Clock clock); @Override Number getValue(int pollerIndex); @VisibleForTesting double getCurrentCount(int pollerIndex); @Override void initializeSpectator(TagList tags); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testInitialPollIsZero() { clock.set(time(1)); DoubleCounter c = newInstance("foo"); assertEquals(c.getValue(1).doubleValue(), 0.0); }
@Test public void testHasRightType() throws Exception { assertEquals(newInstance("foo").getConfig().getTags().getValue(DataSourceType.KEY), "NORMALIZED"); }