use of com.epam.pipeline.controller.vo.notification.NotificationMessageVO in project cloud-pipeline by epam.
the class NotificationManagerTest method testCreateNotificationFailsIfReceiverIsNotSpecified.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Throwable.class)
public void testCreateNotificationFailsIfReceiverIsNotSpecified() {
final NotificationMessageVO messageWithoutUserNames = new NotificationMessageVO();
messageWithoutUserNames.setBody(BODY);
messageWithoutUserNames.setSubject(SUBJECT);
assertThrows(IllegalArgumentException.class, () -> notificationManager.createNotification(messageWithoutUserNames));
}
use of com.epam.pipeline.controller.vo.notification.NotificationMessageVO in project cloud-pipeline by epam.
the class NotificationManagerTest method testCreateNotificationWithExistingCopyUser.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Throwable.class)
public void testCreateNotificationWithExistingCopyUser() {
final NotificationMessageVO message = new NotificationMessageVO();
message.setBody(BODY);
message.setSubject(SUBJECT);
message.setParameters(PARAMETERS);
message.setToUser(testUser1.getUserName());
message.setCopyUsers(Collections.singletonList(testUser2.getUserName()));
final NotificationMessage savedMessage = notificationManager.createNotification(message);
final NotificationMessage loadedMessage = monitoringNotificationDao.loadMonitoringNotification(savedMessage.getId());
Assert.assertEquals(BODY, loadedMessage.getBody());
Assert.assertEquals(SUBJECT, loadedMessage.getSubject());
Assert.assertEquals(PARAMETERS, loadedMessage.getTemplateParameters());
Assert.assertEquals(testUser1.getId(), loadedMessage.getToUserId());
Assert.assertEquals(Collections.singletonList(testUser2.getId()), loadedMessage.getCopyUserIds());
}
Aggregations