summaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyNotificationMailTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyNotificationMailTest.java')
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyNotificationMailTest.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyNotificationMailTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyNotificationMailTest.java
index 95296f4b0..e270583bb 100644
--- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyNotificationMailTest.java
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyNotificationMailTest.java
@@ -29,6 +29,7 @@ import java.util.List;
import org.junit.Before;
import org.junit.Test;
import static org.mockito.Mockito.when;
+import org.onap.policy.common.utils.network.NetworkUtil;
import org.onap.policy.controller.PolicyController;
import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.PolicyVersion;
@@ -46,11 +47,17 @@ public class PolicyNotificationMailTest {
PolicyController.setjUnit(true);
PolicyController.setSmtpApplicationName("Test");
PolicyController.setSmtpEmailExtension("test.com");
- PolicyController.setSmtpHost("test");
- PolicyController.setSmtpPort("23");
+ PolicyController.setSmtpHost("localhost");
PolicyController.setSmtpPassword("test");
PolicyController.setSmtpUsername("test");
+ /*
+ * Allocate a port to which the mail sender should connect, but don't actually
+ * start a listener on the port so that connection attempts will be immediately
+ * rejected.
+ */
+ PolicyController.setSmtpPort(String.valueOf(NetworkUtil.allocPort()));
+
version = new PolicyVersion();
version.setPolicyName("com/Config_Test");
version.setModifiedBy("xyz");