use of amu.zhcet.notification.recipient.NotificationRecipient in project zhcet-web by zhcet-amu.
the class NotificationSendingServiceTest method saveNotificationWithoutEmailPropagation.
@Test
public void saveNotificationWithoutEmailPropagation() {
Notification notification = getNotification();
notification.setStopEmailPropagation(true);
setBehaviour();
notificationSendingService.sendNotification(notification);
List<NotificationRecipient> recipients = getRecipients();
verify(emailSendingService, never()).sendEmailForNotification(notification, userList);
recipients.forEach(notificationRecipient -> {
verify(emailSendingService, never()).sendEmailForNotification(notificationRecipient);
});
}
use of amu.zhcet.notification.recipient.NotificationRecipient in project zhcet-web by zhcet-amu.
the class NotificationSendingServiceTest method saveNotificationWithoutFirebasePropagation.
@Test
public void saveNotificationWithoutFirebasePropagation() {
Notification notification = getNotification();
notification.setStopFirebasePropagation(true);
setBehaviour();
notificationSendingService.sendNotification(notification);
List<NotificationRecipient> recipients = getRecipients();
recipients.forEach(notificationRecipient -> {
verify(firebaseNotificationSender, never()).sendFirebaseNotification(notificationRecipient);
});
}
use of amu.zhcet.notification.recipient.NotificationRecipient in project zhcet-web by zhcet-amu.
the class NotificationSendingService method fromNotification.
private NotificationRecipient fromNotification(Notification notification, User user) {
NotificationRecipient notificationRecipient = new NotificationRecipient();
notificationRecipient.setNotification(notification);
notificationRecipient.setRecipient(user);
return notificationRecipient;
}
use of amu.zhcet.notification.recipient.NotificationRecipient in project zhcet-web by zhcet-amu.
the class NotificationSendingService method sendUserNotification.
private void sendUserNotification(Notification notification, User user) {
NotificationRecipient notificationRecipient = fromNotification(notification, user);
cachedNotificationService.save(notificationRecipient);
completeNotificationDistribution(notificationRecipient);
}
use of amu.zhcet.notification.recipient.NotificationRecipient in project zhcet-web by zhcet-amu.
the class NotificationSendingServiceTest method saveNotificationRecipient.
@Test
public void saveNotificationRecipient() {
Notification notification = getNotification();
setBehaviour();
notificationSendingService.sendNotification(notification);
Stream.of(userIds).forEach(id -> verify(cachedNotificationService).resetUnreadCount(id));
List<NotificationRecipient> recipients = getRecipients();
verify(emailSendingService).sendEmailForNotification(notification, userList);
recipients.forEach(notificationRecipient -> {
assertTrue(Arrays.asList(userIds).contains(notificationRecipient.getRecipient().getUserId()));
assertEquals(notification, notificationRecipient.getNotification());
verify(cachedNotificationService).resetUnreadCount(notificationRecipient.getRecipient().getUserId());
verify(firebaseNotificationSender).sendFirebaseNotification(notificationRecipient);
});
}
Aggregations