### Question:
MetricsConf { @Bean ScheduledReporterFactory runningScheduledReporterFactory( MetricRegistry runningMetricRegistry, ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return new GraphiteScheduledReporterFactory(runningMetricRegistry, validatedGraphite.getHost(), validatedGraphite.getFormattedPrefix()); } return new LoggingScheduledReporterFactory(runningMetricRegistry); }    }### Answer:
@Test public void graphiteReporter() { when(validatedGraphite.isEnabled()).thenReturn(true); ScheduledReporterFactory reporterFactory = new MetricsConf().runningScheduledReporterFactory(new MetricRegistry(), validatedGraphite); assertTrue(reporterFactory instanceof GraphiteScheduledReporterFactory); }
@Test public void defaultReporter() { when(validatedGraphite.isEnabled()).thenReturn(false); ScheduledReporterFactory reporterFactory = new MetricsConf().runningScheduledReporterFactory(new MetricRegistry(), validatedGraphite); assertTrue(reporterFactory instanceof LoggingScheduledReporterFactory); }