SesEmailServiceFactory extends EmailServiceFactory { @Override public EmailHealthCheck createHealthCheck() { LOG.info("Creating SES implementation of EmailHealthCheck"); initializeSesClient(); return new SesHealthCheck(sesClient); }  String getEndpoint(); String getRegion(); @Override EmailService createEmailService(MetricRegistry metrics); @Override EmailHealthCheck createHealthCheck(); @JsonIgnore @ValidationMethod(message = "The endpoint, region, and fromAddress fields must be filled out " + "to use SES as the email service.") boolean isFilledOut(); @Override String toString();  }
@Test void testSesClientCreatedOnce() throws Exception { EmailServiceFactory serviceFactory = FACTORY.build(new File(Resources.getResource( "fixtures/configuration/email/valid-config.yaml").toURI())); assertTrue(serviceFactory instanceof SesEmailServiceFactory); SesEmailServiceFactory sesServiceFactory = (SesEmailServiceFactory) serviceFactory; sesServiceFactory.createHealthCheck(); SesClient createdClientAfterOne = sesServiceFactory.sesClient; sesServiceFactory.createHealthCheck(); SesClient createdClientAfterTwo = sesServiceFactory.sesClient; assertSame(createdClientAfterOne, createdClientAfterTwo); }