### Question:
MetricsReportingTask extends AbstractReportingTask { @OnScheduled public void connect(ConfigurationContext context) { if (reporter == null) { reporter = ((MetricReporterService) context.getProperty(REPORTER_SERVICE).asControllerService()) .createReporter(metricRegistry); } }  @OnScheduled void connect(ConfigurationContext context); @Override void onTrigger(ReportingContext context);  }### Answer:
@Test public void testConnectCreatesSingleReporter() throws Exception { testedReportingTask.initialize(reportingInitContextStub); testedReportingTask.connect(configurationContextStub); testedReportingTask.connect(configurationContextStub); verify(reporterServiceStub, times(1)).createReporter(any()); }