use of com.synopsys.integration.alert.service.email.model.EmailGlobalConfigModel in project hub-alert by blackducksoftware.
the class JavamailPropertiesFactoryTest method testCreateFromEmailGlobalConfigModel.
@Test
public void testCreateFromEmailGlobalConfigModel() {
EmailGlobalConfigModel emailGlobalConfigModel = new EmailGlobalConfigModel();
emailGlobalConfigModel.setSmtpFrom(EXPECTED_FROM_VALUE);
emailGlobalConfigModel.setSmtpHost(EXPECTED_HOST_VALUE);
emailGlobalConfigModel.setSmtpPort(EXPECTED_PORT_VALUE);
emailGlobalConfigModel.setSmtpAuth(EXPECTED_AUTH_VALUE);
emailGlobalConfigModel.setSmtpUsername(EXPECTED_USERNAME_VALUE);
emailGlobalConfigModel.setSmtpPassword(EXPECTED_PASSWORD_VALUE);
emailGlobalConfigModel.setAdditionalJavaMailProperties(Map.of(EmailPropertyKeys.JAVAMAIL_EHLO_KEY.getPropertyKey(), EXPECTED_EHLO_VALUE));
JavamailPropertiesFactory javamailPropertiesFactory = new JavamailPropertiesFactory();
Properties properties = javamailPropertiesFactory.createJavaMailProperties(emailGlobalConfigModel);
assertEquals(EXPECTED_FROM_VALUE, properties.getProperty(EmailPropertyKeys.JAVAMAIL_FROM_KEY.getPropertyKey()));
assertEquals(EXPECTED_HOST_VALUE, properties.getProperty(EmailPropertyKeys.JAVAMAIL_HOST_KEY.getPropertyKey()));
assertEquals(EXPECTED_PORT_VALUE_STRING, properties.getProperty(EmailPropertyKeys.JAVAMAIL_PORT_KEY.getPropertyKey()));
assertEquals(EXPECTED_AUTH_VALUE_STRING, properties.getProperty(EmailPropertyKeys.JAVAMAIL_AUTH_KEY.getPropertyKey()));
assertEquals(EXPECTED_USERNAME_VALUE, properties.getProperty(EmailPropertyKeys.JAVAMAIL_USER_KEY.getPropertyKey()));
assertEquals(EXPECTED_EHLO_VALUE, properties.getProperty(EmailPropertyKeys.JAVAMAIL_EHLO_KEY.getPropertyKey()));
assertNull(properties.getProperty(EmailPropertyKeys.JAVAMAIL_PASSWORD_KEY.getPropertyKey()));
}
Aggregations