use of org.sonar.plugins.emailnotifications.api.EmailMessage 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.plugins.emailnotifications.api.EmailMessage 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.plugins.emailnotifications.api.EmailMessage in project sonarqube by SonarSource.
the class MyNewIssuesEmailTemplateTest method format_email_with_all_fields_filled.
@Test
public void format_email_with_all_fields_filled() throws Exception {
Notification notification = newNotification();
addTags(notification);
addRules(notification);
addComponents(notification);
EmailMessage message = underTest.format(notification);
// TODO datetime to be completed when test is isolated from JVM timezone
assertStartsWithFile(message.getMessage(), getClass().getResource("MyNewIssuesEmailTemplateTest/email_with_all_details.txt"));
}
use of org.sonar.plugins.emailnotifications.api.EmailMessage in project sonarqube by SonarSource.
the class MyNewIssuesEmailTemplateTest 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 = underTest.format(notification);
// TODO datetime to be completed when test is isolated from JVM timezone
assertStartsWithFile(message.getMessage(), getClass().getResource("MyNewIssuesEmailTemplateTest/email_with_no_assignee_tags_components.txt"));
}
use of org.sonar.plugins.emailnotifications.api.EmailMessage in project sonarqube by SonarSource.
the class NewIssuesEmailTemplateTest method subject.
@Test
public void subject() {
Notification notification = newNotification();
EmailMessage message = template.format(notification);
assertThat(message.getSubject()).isEqualTo("Struts: 32 new issues (new debt: 1d3h)");
}
Aggregations