ScheduledReporter implements Closeable, Reporter { @Override public void close() { stop(); } protected  ScheduledReporter(MetricRegistry registry,
                                String name,
                                MetricFilter filter,
                                TimeUnit rateUnit,
                                TimeUnit durationUnit); protected  ScheduledReporter(MetricRegistry registry,
                                String name,
                                MetricFilter filter,
                                TimeUnit rateUnit,
                                TimeUnit durationUnit,
                                ScheduledExecutorService executor); protected  ScheduledReporter(MetricRegistry registry,
                                String name,
                                MetricFilter filter,
                                TimeUnit rateUnit,
                                TimeUnit durationUnit,
                                ScheduledExecutorService executor,
                                boolean shutdownExecutorOnStop); protected  ScheduledReporter(MetricRegistry registry,
                                String name,
                                MetricFilter filter,
                                TimeUnit rateUnit,
                                TimeUnit durationUnit,
                                ScheduledExecutorService executor,
                                boolean shutdownExecutorOnStop,
                                Set<MetricAttribute> disabledMetricAttributes); void start(long period, TimeUnit unit); synchronized void start(long initialDelay, long period, TimeUnit unit); void stop(); @Override void close(); void report(); @SuppressWarnings("rawtypes") abstract void report(SortedMap<String, Gauge> gauges,
                                SortedMap<String, Counter> counters,
                                SortedMap<String, Histogram> histograms,
                                SortedMap<String, Meter> meters,
                                SortedMap<String, Timer> timers);  }
@Test public void createWithNullMetricRegistry() { ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); DummyReporter r = null; try { r = new DummyReporter(null, "example", MetricFilter.ALL, TimeUnit.SECONDS, TimeUnit.MILLISECONDS, executor); Assert.fail("NullPointerException must be thrown !!!"); } catch (NullPointerException e) { Assert.assertEquals("registry == null", e.getMessage()); } finally { if (r != null) { r.close(); } } }