use of org.sonar.server.issue.notification.EmailMessage in project sonarqube by SonarSource.
the class BuiltInQPChangeNotificationTemplateTest method notification_contains_many_profiles.
@Test
public void notification_contains_many_profiles() {
String profileName1 = "profile1_" + randomAlphanumeric(20);
String languageKey1 = "langkey1_" + randomAlphanumeric(20);
String languageName1 = "langName1_" + randomAlphanumeric(20);
String profileName2 = "profile2_" + randomAlphanumeric(20);
String languageKey2 = "langkey2_" + randomAlphanumeric(20);
String languageName2 = "langName2_" + randomAlphanumeric(20);
BuiltInQPChangeNotificationBuilder notification = new BuiltInQPChangeNotificationBuilder().addProfile(Profile.newBuilder().setProfileName(profileName1).setLanguageKey(languageKey1).setLanguageName(languageName1).setNewRules(2).build()).addProfile(Profile.newBuilder().setProfileName(profileName2).setLanguageKey(languageKey2).setLanguageName(languageName2).setNewRules(13).build());
EmailMessage emailMessage = underTest.format(notification.build());
assertThat(emailMessage.getMessage()).containsSubsequence("The following built-in profiles have been updated:\n", profileTitleText(profileName1, languageKey1, languageName1), " 2 new rules\n", profileTitleText(profileName2, languageKey2, languageName2), " 13 new rules\n", "This is a good time to review your quality profiles and update them to benefit from the latest evolutions: " + server.getPublicRootUrl() + "/profiles");
}
use of org.sonar.server.issue.notification.EmailMessage in project sonarqube by SonarSource.
the class BuiltInQPChangeNotificationTemplateTest method notification_contains_encoded_profile_name.
@Test
public void notification_contains_encoded_profile_name() {
BuiltInQPChangeNotificationBuilder notification = new BuiltInQPChangeNotificationBuilder().addProfile(Profile.newBuilder().setProfileName("Sonar Way").setLanguageKey("java").setLanguageName(newLanguageName()).build());
EmailMessage emailMessage = underTest.format(notification.build());
assertThat(emailMessage.getMessage()).contains(server.getPublicRootUrl() + "/profiles/changelog?language=java&name=Sonar+Way");
}
use of org.sonar.server.issue.notification.EmailMessage in project sonarqube by SonarSource.
the class BuiltInQPChangeNotificationTemplateTest method notification_contains_from_and_to_date.
@Test
public void notification_contains_from_and_to_date() {
String profileName = newProfileName();
String languageKey = newLanguageKey();
String languageName = newLanguageName();
long startDate = 1_000_000_000_000L;
long endDate = startDate + 1_100_000_000_000L;
BuiltInQPChangeNotificationBuilder notification = new BuiltInQPChangeNotificationBuilder().addProfile(Profile.newBuilder().setProfileName(profileName).setLanguageKey(languageKey).setLanguageName(languageName).setStartDate(startDate).setEndDate(endDate).build());
EmailMessage emailMessage = underTest.format(notification.build());
assertMessage(emailMessage, profileTitleText(profileName, languageKey, languageName, formatDate(new Date(startDate)), formatDate(new Date(endDate))));
}
use of org.sonar.server.issue.notification.EmailMessage in project sonarqube by SonarSource.
the class BuiltInQPChangeNotificationTemplateTest method notification_contains_count_of_new_rules.
@Test
public void notification_contains_count_of_new_rules() {
String profileName = newProfileName();
String languageKey = newLanguageKey();
String languageName = newLanguageName();
BuiltInQPChangeNotificationBuilder notification = new BuiltInQPChangeNotificationBuilder().addProfile(Profile.newBuilder().setProfileName(profileName).setLanguageKey(languageKey).setLanguageName(languageName).setNewRules(2).build());
EmailMessage emailMessage = underTest.format(notification.build());
assertMessage(emailMessage, "\n 2 new rules\n");
}
use of org.sonar.server.issue.notification.EmailMessage in project sonarqube by SonarSource.
the class BuiltInQPChangeNotificationTemplateTest method notification_contains_list_of_new_updated_and_removed_rules.
@Test
public void notification_contains_list_of_new_updated_and_removed_rules() {
String profileName = newProfileName();
String languageKey = newLanguageKey();
String languageName = newLanguageName();
BuiltInQPChangeNotificationBuilder notification = new BuiltInQPChangeNotificationBuilder().addProfile(Profile.newBuilder().setProfileName(profileName).setLanguageKey(languageKey).setLanguageName(languageName).setNewRules(2).setUpdatedRules(3).setRemovedRules(4).build());
EmailMessage emailMessage = underTest.format(notification.build());
assertMessage(emailMessage, "\n" + " 2 new rules\n" + " 3 rules have been updated\n" + " 4 rules removed\n");
}
Aggregations