@Test
public void testSendEmailError() {

    Set<String> recipients = new HashSet<>(Arrays.asList("user.user1", "user.user2", "user.user3"));
    String subject = "test email subject";
    String body = "test email body";
    System.setProperty("athenz.notification_email_domain_to", "example.com");
    System.setProperty("athenz.notification_email_domain_from", "from.example.com");
    System.setProperty("athenz.notification_email_from", "no-reply-athenz");
    AmazonSimpleEmailService ses = mock(AmazonSimpleEmailService.class);
    Mockito.when(ses.sendEmail(any(SendEmailRequest.class))).thenThrow(new RuntimeException());
    AWSEmailProvider awsEmailProvider = new AWSEmailProvider(ses);
    EmailNotificationService svc = new EmailNotificationService(awsEmailProvider);
    boolean result = svc.sendEmail(recipients, subject, body);
    assertFalse(result);
    System.clearProperty("athenz.notification_email_domain_from");
    System.clearProperty("athenz.notification_email_domain_to");
    System.clearProperty("athenz.notification_email_from");
}