### Question:
ScheduledReporterWrapper extends ScheduledReporter { @Override public void report() { safeReport(() -> { scheduledReporter.report(); return null; }); } ScheduledReporterWrapper(ConfigurationProperties configurationProperties, T scheduledReporter, ConfigKey<Boolean> enabledKey); T getScheduledReporter(); @Override void start(long period, TimeUnit unit); @Override void stop(); @Override void close(); @Override void report(); @Override void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters,
        SortedMap<String, Timer> timers);  }### Answer:
@Test public void testReportException() { doReturn(true).when(mockProperties).get(ENABLED_KEY); doThrow(new RuntimeException()).when(mockReporter).report(); doThrow(new RuntimeException()).when(mockReporter).report( any(SortedMap.class), any(SortedMap.class), any(SortedMap.class), any(SortedMap.class), any(SortedMap.class)); wrapper.report(); verify(mockReporter, times(1)).report(); wrapper.report(null, null, null, null, null); verify(mockReporter, times(1)).report( any(SortedMap.class), any(SortedMap.class), any(SortedMap.class), any(SortedMap.class), any(SortedMap.class) ); }
@Test public void testDisabled() { doReturn(false).when(mockProperties).get(ENABLED_KEY); wrapper.report(); verify(mockReporter, times(0)).report(); wrapper.report(null, null, null, null, null); verify(mockReporter, times(0)).report( any(SortedMap.class), any(SortedMap.class), any(SortedMap.class), any(SortedMap.class), any(SortedMap.class) ); }