NoopMetricsFactory implements MetricsFactory { @Override public Timer createTimer(final String name, final Map<String, String> tags) { return new Timer() { @Override public void durationMicros(long time) { } }; }  @Override Counter createCounter(String name, Map<String, String> tags); @Override Timer createTimer(final String name, final Map<String, String> tags); @Override Gauge createGauge(final String name, final Map<String, String> tags);  }
@Test public void metricNameIsUsedForTimer() { Map<String, String> tags = new HashMap<>(1); tags.put("foo", "bar"); NoopMetricsFactory metricsFactory = new NoopMetricsFactory(); metricsFactory.createTimer("thetimer", tags); }
@Test public void timerValueIsIncreased() { Map<String, String> tags = new HashMap<>(1); tags.put("foo", "bar"); NoopMetricsFactory metricsFactory = new NoopMetricsFactory(); Timer timer = metricsFactory.createTimer("thetimer", tags); timer.durationMicros(1); }