- @Test
- public final void testJavaMailSenderImpl() {
- PolicyNotificationMail notificationMail = new PolicyNotificationMail();
- try{
- assertTrue(notificationMail.javaMailSenderImpl() != null);
- }catch(Exception e){
- fail();
- }
- }
+ /**
+ * setUp.
+ *
+ * @throws Exception should not throw one
+ */
+ @Before
+ public void setUp() throws Exception {
+ PolicyController.setjUnit(true);
+ PolicyController.setSmtpApplicationName("Test");
+ PolicyController.setSmtpEmailExtension("test.com");
+ 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");
+
+ WatchPolicyNotificationTable watch = new WatchPolicyNotificationTable();
+ watch.setPolicyName("com/Config_Test");
+ data = new ArrayList<>();
+ data.add(watch);
+
+ commonClassDao = mock(CommonClassDao.class);
+ PolicyController.setCommonClassDao(commonClassDao);
+ when(commonClassDao.getDataByQuery("from WatchPolicyNotificationTable where policyName like:policyFileName",
+ null)).thenReturn(data);
+ }