### Question:
EmailNotification implements NotificationPlugin { public void sendNotification(ResourceMessage resourceMessage, EntityNotification entityNotification) throws FalconException { try { message.addRecipients(Message.RecipientType.TO, NotificationUtil.getToAddress(entityNotification.getTo())); if (resourceMessage.getAction().equals("wf-instance-succeeded")) { sendSuccessNotification(resourceMessage); } else if ((resourceMessage.getAction().equals("wf-instance-failed"))) { sendFailureNotification(resourceMessage); } Transport.send(message); } catch (MessagingException e) { throw new FalconException("Error occurred while sending email message using SMTP:" +e); } } EmailNotification(); void sendNotification(ResourceMessage resourceMessage, EntityNotification entityNotification);  }### Answer:
@Test public void testSendNotification() throws Exception { String notificationType = "email"; String emailTo = "falcon_to@localhost"; Notification notification = new Notification(); notification.setType(notificationType); notification.setTo(emailTo); NotificationPlugin pluginType = NotificationHandler.getNotificationType(notification.getType()); Assert.assertNotNull(pluginType); pluginType.sendNotification(resourceMessage, notification); mailServer.waitForIncomingEmail(5000, 1); Message[] messages = mailServer.getReceivedMessages(); Assert.assertNotNull(messages); Assert.assertEquals(messages[0].getFrom()[0].toString(), EMAIL_FROM); Assert.assertEquals(messages[0].getAllRecipients()[0].toString(), emailTo); Assert.assertEquals(messages[0].getSubject(), "Falcon Instance Succeeded : Workflow id:001-oozie-wf " + "Name:pig-process Type:process"); }