use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class MyNewIssuesEmailTemplateTest method subject_on_branch.
@Test
public void subject_on_branch() {
Notification notification = newNotification(32).setFieldValue("branch", "feature1");
EmailMessage message = underTest.format(notification);
assertThat(message.getSubject()).isEqualTo("You have 32 new issues on project Struts (feature1)");
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class MyNewIssuesEmailTemplateTest method format_supports_null_version.
@Test
public void format_supports_null_version() {
Notification notification = newNotification(32).setFieldValue("branch", "feature1");
EmailMessage message = underTest.format(notification);
// TODO datetime to be completed when test is isolated from JVM timezone
assertThat(message.getMessage()).startsWith("Project: Struts\n" + "Branch: feature1\n" + "\n" + "32 new issues (new debt: 1d3h)\n" + "\n" + " Type\n" + " Bug: 1 Vulnerability: 3 Code Smell: 0\n" + "\n" + "More details at: http://nemo.sonarsource.org/project/issues?id=org.apache%3Astruts&assignees=lo.gin&branch=feature1&createdAt=2010-05-18");
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class MyNewIssuesEmailTemplateTest method message_id.
@Test
public void message_id() {
Notification notification = newNotification(32);
EmailMessage message = underTest.format(notification);
assertThat(message.getMessageId()).isEqualTo("my-new-issues/org.apache:struts");
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class MyNewIssuesEmailTemplateTest method no_format_if_not_the_correct_notif.
@Test
public void no_format_if_not_the_correct_notif() {
Notification notification = new Notification("new-issues");
EmailMessage message = underTest.format(notification);
assertThat(message).isNull();
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class MyNewIssuesEmailTemplateTest method do_not_add_footer_when_properties_missing.
@Test
public void do_not_add_footer_when_properties_missing() {
Notification notification = new Notification(MyNewIssuesNotification.MY_NEW_ISSUES_NOTIF_TYPE).setFieldValue(RULE_TYPE + ".count", "32").setFieldValue("projectName", "Struts");
EmailMessage message = underTest.format(notification);
assertThat(message.getMessage()).doesNotContain("See it");
}
Aggregations