use of org.sonar.plugins.emailnotifications.api.EmailMessage 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.plugins.emailnotifications.api.EmailMessage in project sonarqube by SonarSource.
the class MyNewIssuesEmailTemplateTest method message_id.
@Test
public void message_id() {
Notification notification = newNotification();
EmailMessage message = underTest.format(notification);
assertThat(message.getMessageId()).isEqualTo("my-new-issues/org.apache:struts");
}
use of org.sonar.plugins.emailnotifications.api.EmailMessage in project sonarqube by SonarSource.
the class MyNewIssuesEmailTemplateTest method subject.
@Test
public void subject() {
Notification notification = newNotification();
EmailMessage message = underTest.format(notification);
assertThat(message.getSubject()).isEqualTo("You have 32 new issues on project Struts");
}
use of org.sonar.plugins.emailnotifications.api.EmailMessage 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(SEVERITY + ".count", "32").setFieldValue("projectName", "Struts");
EmailMessage message = underTest.format(notification);
assertThat(message.getMessage()).doesNotContain("See it");
}
use of org.sonar.plugins.emailnotifications.api.EmailMessage in project sonarqube by SonarSource.
the class AlertsEmailTemplateTest method shouldFormatNewAlertWithSeveralMessages.
@Test
public void shouldFormatNewAlertWithSeveralMessages() {
Notification notification = createNotification("Orange (was Red)", "violations > 4, coverage < 75%", "WARN", "true");
EmailMessage message = template.format(notification);
assertThat(message.getMessageId(), is("alerts/45"));
assertThat(message.getSubject(), is("New quality gate threshold reached on \"Foo\""));
assertThat(message.getMessage(), is("" + "Project: Foo\n" + "Quality gate status: Orange (was Red)\n" + "\n" + "New quality gate thresholds:\n" + " - violations > 4\n" + " - coverage < 75%\n" + "\n" + "See it in SonarQube: http://nemo.sonarsource.org/dashboard/index/org.sonar.foo:foo"));
}
Aggregations