use of com.yahoo.athenz.common.server.notification.impl.NotificationAuthorityForTest in project athenz by yahoo.
the class NotificationToEmailConverterCommonTest method testGetFullyQualifiedEmailAddressesUserAuthority.
@Test
public void testGetFullyQualifiedEmailAddressesUserAuthority() {
System.clearProperty("athenz.user_domain");
System.setProperty("athenz.user_domain", "entuser");
System.setProperty("athenz.notification_email_domain_from", "from.example.com");
System.setProperty("athenz.notification_email_domain_to", "example.com");
Set<String> recipients = new HashSet<>(Arrays.asList("entuser.user1", "entuser.user2", "entuser.user3", "unknown.user"));
Authority notificationAuthorityForTest = new NotificationAuthorityForTest();
NotificationToEmailConverterCommon notificationToEmailConverterCommon = new NotificationToEmailConverterCommon(notificationAuthorityForTest);
Set<String> recipientsResp = notificationToEmailConverterCommon.getFullyQualifiedEmailAddresses(recipients);
assertNotNull(recipientsResp);
assertEquals(recipientsResp.size(), 4);
assertTrue(recipientsResp.contains("entuser.user1@mail.from.authority.com"));
assertTrue(recipientsResp.contains("entuser.user2@mail.from.authority.com"));
assertTrue(recipientsResp.contains("entuser.user3@mail.from.authority.com"));
assertTrue(recipientsResp.contains("unknown.user@example.com"));
System.clearProperty("athenz.notification_email_domain_from");
System.clearProperty("athenz.notification_email_domain_to");
System.clearProperty("athenz.user_domain");
}
Aggregations