use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class IssueChangesEmailTemplateTest method notification_contains_user_login_when_user_is_removed.
@Test
public void notification_contains_user_login_when_user_is_removed() {
db.users().insertUser(newUserDto().setLogin("simon").setName("Simon").setActive(false));
Notification notification = new IssueChangeNotification().setChangeAuthorLogin("simon").setProject("Struts", "org.apache:struts");
EmailMessage message = underTest.format(notification);
assertThat(message.getFrom()).isEqualTo("simon");
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class IssueChangesEmailTemplateTest method notification_sender_should_be_the_author_of_change.
@Test
public void notification_sender_should_be_the_author_of_change() {
db.users().insertUser(newUserDto().setLogin("simon").setName("Simon"));
Notification notification = new IssueChangeNotification().setChangeAuthorLogin("simon").setProject("Struts", "org.apache:struts");
EmailMessage message = underTest.format(notification);
assertThat(message.getFrom()).isEqualTo("Simon");
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class IssueChangesEmailTemplateTest method should_ignore_non_issue_changes.
@Test
public void should_ignore_non_issue_changes() {
Notification notification = new Notification("other");
EmailMessage message = underTest.format(notification);
assertThat(message).isNull();
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class MyNewIssuesNotificationDispatcherTest method do_not_dispatch_if_no_new_notification.
@Test
public void do_not_dispatch_if_no_new_notification() {
Notification notification = new Notification("other-notif");
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 NewIssuesEmailTemplateTest method format_email_with_no_assignees_tags_nor_components.
@Test
public void format_email_with_no_assignees_tags_nor_components() throws Exception {
Notification notification = newNotification();
EmailMessage message = template.format(notification);
// TODO datetime to be completed when test is isolated from JVM timezone
String expectedContent = IOUtils.toString(getClass().getResource("NewIssuesEmailTemplateTest/email_with_partial_details.txt"), StandardCharsets.UTF_8);
assertThat(message.getMessage()).startsWith(StringUtils.remove(expectedContent, '\r'));
}
Aggregations