### Question:
GraphiteReporter extends ScheduledReporter { @VisibleForTesting void initConnection() { tryTimes( MAX_RETRIES, graphite::connect, (e) -> attemptErrorHandling(graphite::close) ); } private  GraphiteReporter(MetricRegistry registry,
                             GraphiteSender graphite,
                             Clock clock,
                             String prefix,
                             TimeUnit rateUnit,
                             TimeUnit durationUnit,
                             MetricFilter filter); static Builder forRegistry(MetricRegistry registry); @Override void report(SortedMap<String, Gauge> gauges,
                       SortedMap<String, Counter> counters,
                       SortedMap<String, Histogram> histograms,
                       SortedMap<String, Meter> meters,
                       SortedMap<String, Timer> timers); @Override void stop();  }### Answer:
@Test public void initConnectionRetriesOnFailure() throws Exception { doThrow(new UnknownHostException("UNKNOWN-HOST")).when(graphite).connect(); try { reporter.initConnection(); fail("Should have thrown an exception"); } catch (UncheckedIOException e) { verify(graphite, times(MAX_RETRIES)).connect(); } }