use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class NewAlertsTest method should_not_dispatch_if_not_alerts_notification.
@Test
public void should_not_dispatch_if_not_alerts_notification() {
Notification notification = new Notification("other-notif");
dispatcher.performDispatch(notification, context);
verify(context, never()).addUser(any(String.class), any(NotificationChannel.class));
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class ChangesOnMyIssueNotificationDispatcherTest method should_dispatch_to_assignee.
@Test
public void should_dispatch_to_assignee() {
Multimap<String, NotificationChannel> recipients = HashMultimap.create();
recipients.put("simon", emailChannel);
recipients.put("freddy", twitterChannel);
recipients.put("godin", twitterChannel);
when(notifications.findNotificationSubscribers(dispatcher, "struts")).thenReturn(recipients);
Notification notification = new IssueChangeNotification().setFieldValue("projectKey", "struts").setFieldValue("changeAuthor", "olivier").setFieldValue("assignee", "freddy");
dispatcher.performDispatch(notification, context);
verify(context).addUser("freddy", twitterChannel);
verify(context, never()).addUser("godin", twitterChannel);
verifyNoMoreInteractions(context);
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class ChangesOnMyIssueNotificationDispatcherTest method should_not_dispatch_if_other_notification_type.
@Test
public void should_not_dispatch_if_other_notification_type() {
Notification notification = new Notification("other-notif");
dispatcher.performDispatch(notification, context);
verify(context, never()).addUser(any(String.class), any(NotificationChannel.class));
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class DoNotFixNotificationDispatcherTest method should_not_dispatch_if_other_notification_type.
@Test
public void should_not_dispatch_if_other_notification_type() {
Notification notification = new Notification("other");
underTest.performDispatch(notification, context);
verify(context, never()).addUser(any(String.class), any(NotificationChannel.class));
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class IssueChangesEmailTemplateTest method email_should_display_plan_change.
@Test
public void email_should_display_plan_change() throws Exception {
Notification notification = generateNotification().setFieldValue("old.actionPlan", null).setFieldValue("new.actionPlan", "ABC 1.0");
EmailMessage email = underTest.format(notification);
assertThat(email.getMessageId()).isEqualTo("issue-changes/ABCDE");
assertThat(email.getSubject()).isEqualTo("Struts, change on issue #ABCDE");
String message = email.getMessage();
String expected = Resources.toString(Resources.getResource("org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_with_action_plan_change.txt"), StandardCharsets.UTF_8);
expected = StringUtils.remove(expected, '\r');
assertThat(message).isEqualTo(expected);
assertThat(email.getFrom()).isNull();
}
Aggregations