use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class QGChangeEmailTemplateTest method shouldNotFormatIfNotCorrectNotification.
@Test
public void shouldNotFormatIfNotCorrectNotification() {
Notification notification = new Notification("other-notif");
EmailMessage message = template.format(notification);
assertThat(message, nullValue());
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class QGChangeEmailTemplateTest method shouldFormatAlertWithSeveralMessagesOnBranch.
@Test
public void shouldFormatAlertWithSeveralMessagesOnBranch() {
Notification notification = createNotification("Failed", "violations > 4, coverage < 75%", "ERROR", "false").setFieldValue("branch", "feature");
EmailMessage message = template.format(notification);
assertThat(message.getMessageId(), is("alerts/45"));
assertThat(message.getSubject(), is("Quality gate status changed on \"Foo (feature)\""));
assertThat(message.getMessage(), is("" + "Project: Foo\n" + "Branch: feature\n" + "Version: V1-SNAP\n" + "Quality gate status: Failed\n" + "\n" + "Quality gate thresholds:\n" + " - violations > 4\n" + " - coverage < 75%\n" + "\n" + "More details at: http://nemo.sonarsource.org/dashboard?id=org.sonar.foo:foo&branch=feature"));
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class QGChangeEmailTemplateTest method shouldFormatBackToGreenMessage.
@Test
public void shouldFormatBackToGreenMessage() {
Notification notification = createNotification("Passed", "", "OK", "false");
EmailMessage message = template.format(notification);
assertThat(message.getMessageId(), is("alerts/45"));
assertThat(message.getSubject(), is("\"Foo\" is back to green"));
assertThat(message.getMessage(), is("" + "Project: Foo\n" + "Version: V1-SNAP\n" + "Quality gate status: Passed\n" + "\n" + "\n" + "More details at: http://nemo.sonarsource.org/dashboard?id=org.sonar.foo:foo"));
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class QGChangeEmailTemplateTest method shouldFormatNewAlertWithOneMessageOnBranch.
@Test
public void shouldFormatNewAlertWithOneMessageOnBranch() {
Notification notification = createNotification("Failed", "violations > 4", "ERROR", "true").setFieldValue("branch", "feature");
EmailMessage message = template.format(notification);
assertThat(message.getMessageId(), is("alerts/45"));
assertThat(message.getSubject(), is("New quality gate threshold reached on \"Foo (feature)\""));
assertThat(message.getMessage(), is("" + "Project: Foo\n" + "Branch: feature\n" + "Version: V1-SNAP\n" + "Quality gate status: Failed\n" + "\n" + "New quality gate threshold: violations > 4\n" + "\n" + "More details at: http://nemo.sonarsource.org/dashboard?id=org.sonar.foo:foo&branch=feature"));
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class QGChangeEmailTemplateTest method shouldFormatAlertWithSeveralMessages.
@Test
public void shouldFormatAlertWithSeveralMessages() {
Notification notification = createNotification("Failed", "violations > 4, coverage < 75%", "ERROR", "false");
EmailMessage message = template.format(notification);
assertThat(message.getMessageId(), is("alerts/45"));
assertThat(message.getSubject(), is("Quality gate status changed on \"Foo\""));
assertThat(message.getMessage(), is("" + "Project: Foo\n" + "Version: V1-SNAP\n" + "Quality gate status: Failed\n" + "\n" + "Quality gate thresholds:\n" + " - violations > 4\n" + " - coverage < 75%\n" + "\n" + "More details at: http://nemo.sonarsource.org/dashboard?id=org.sonar.foo:foo"));
}
Aggregations