### Question:
ReporterFactory { public Reporter createReporter(ConfigurationRegistry configurationRegistry, ApmServerClient apmServerClient, MetaData metaData) { ReporterConfiguration reporterConfiguration = configurationRegistry.getConfig(ReporterConfiguration.class); ReportingEventHandler reportingEventHandler = getReportingEventHandler(configurationRegistry, reporterConfiguration, metaData, apmServerClient); return new ApmServerReporter(true, reporterConfiguration, reportingEventHandler); }  Reporter createReporter(ConfigurationRegistry configurationRegistry,
                                   ApmServerClient apmServerClient,
                                   MetaData metaData);  }### Answer:
@Test void testNotValidatingSslCertificate() throws Exception { when(reporterConfiguration.isVerifyServerCert()).thenReturn(false); ApmServerClient apmServerClient = new ApmServerClient(reporterConfiguration); apmServerClient.start(); final Reporter reporter = reporterFactory.createReporter(configuration, apmServerClient, MetaData.create(configuration, null)); reporter.start(); reporter.report(new Transaction(MockTracer.create())); reporter.flush().get(); assertThat(requestHandled) .describedAs("request should ignore certificate validation and properly execute") .isTrue(); }
@Test void testValidatingSslCertificate() throws Exception { when(reporterConfiguration.isVerifyServerCert()).thenReturn(true); ApmServerClient apmServerClient = new ApmServerClient(reporterConfiguration); apmServerClient.start(); final Reporter reporter = reporterFactory.createReporter(configuration, apmServerClient, MetaData.create(configuration, null)); reporter.start(); reporter.report(new Transaction(MockTracer.create())); reporter.flush().get(); assertThat(requestHandled) .describedAs("request should have produced a certificate validation error") .isFalse(); }