EmailNotifier extends AuditNotifier { @Override protected boolean sendAdditionalNotification(NotificationContext context) { requireArgument(context != null, "Notification context cannot be null."); super.sendAdditionalNotification(context); Set<String> recipients = _getNotificationSubscriptions(context); EmailContext emailContext = getEmailContextForEmailNotifications(context, NotificationStatus.TRIGGERED, recipients); boolean isSent = _mailService.sendMessage(emailContext); if (!isSent) { context.getHistory().appendMessageNUpdateHistory(MessageFormat.format("Not able to send email for triggered notification: `{0}.` to recipient {1}", context.getNotification().getName(), recipients), null, 0); } return isSent; } @Inject  EmailNotifier(MetricService metricService, AnnotationService annotationService, AuditService auditService,
                         MailService mailService, SystemConfiguration config, Provider<EntityManager> emf); @Override String getName();  }
@Test(expected = IllegalArgumentException.class) public void testSendAdditionalNotificationWhenNotificationContextIsNull() { boolean isSent = emailNotifier.sendAdditionalNotification(null); }
@Test(expected = IllegalArgumentException.class) public void testClearAdditionalNotificationWhenNotificationContextIsNull() { boolean isSent = emailNotifier.sendAdditionalNotification(null); }