DynamicCounter extends AbstractMonitor<Long> implements CompositeMonitor<Long>, SpectatorMonitor { @Override public Long getValue(int pollerIndex) { return (long) counters.size(); } private  DynamicCounter(); @Override void initializeSpectator(TagList tags); static void increment(MonitorConfig config); static void increment(String name, String... tags); static void increment(MonitorConfig config, long delta); static void increment(String name, TagList list); static void increment(String name, TagList list, long delta); @Override @SuppressWarnings("unchecked") List<Monitor<?>> getMonitors(); @Override Long getValue(int pollerIndex); @Override String toString();  }
@Test public void testGetValue() throws Exception { clock.set(0L); DynamicCounter.increment("test1", tagList); StepCounter c = getByName("test1"); clock.set(60000L); assert c != null; assertEquals(c.getCount(0), 1L); c.increment(13); clock.set(120000L); assertEquals(c.getCount(0), 13L); }