use of org.sonar.server.issue.notification.EmailMessage in project sonarqube by SonarSource.
the class BuiltInQPChangeNotificationTemplateTest method notification_contains_profiles_sorted_by_language_then_by_profile_name.
@Test
public void notification_contains_profiles_sorted_by_language_then_by_profile_name() {
String languageKey1 = "langkey1_" + randomAlphanumeric(20);
String languageName1 = "langName1_" + randomAlphanumeric(20);
String languageKey2 = "langKey2_" + randomAlphanumeric(20);
String languageName2 = "langName2_" + randomAlphanumeric(20);
String profileName1 = "profile1_" + randomAlphanumeric(20);
String profileName2 = "profile2_" + randomAlphanumeric(20);
String profileName3 = "profile3_" + randomAlphanumeric(20);
BuiltInQPChangeNotificationBuilder notification = new BuiltInQPChangeNotificationBuilder().addProfile(Profile.newBuilder().setProfileName(profileName3).setLanguageKey(languageKey2).setLanguageName(languageName2).build()).addProfile(Profile.newBuilder().setProfileName(profileName2).setLanguageKey(languageKey1).setLanguageName(languageName1).build()).addProfile(Profile.newBuilder().setProfileName(profileName1).setLanguageKey(languageKey2).setLanguageName(languageName2).build());
EmailMessage emailMessage = underTest.format(notification.build());
assertThat(emailMessage.getMessage()).containsSubsequence("\"" + profileName2 + "\" - " + languageName1, "\"" + profileName1 + "\" - " + languageName2, "\"" + profileName3 + "\" - " + languageName2);
}
use of org.sonar.server.issue.notification.EmailMessage in project sonarqube by SonarSource.
the class BuiltInQPChangeNotificationTemplateTest method notification_supports_grammar_for_single_rule_added_removed_or_updated.
@Test
public void notification_supports_grammar_for_single_rule_added_removed_or_updated() {
String profileName = newProfileName();
String languageKey = newLanguageKey();
String languageName = newLanguageName();
BuiltInQPChangeNotificationBuilder notification = new BuiltInQPChangeNotificationBuilder().addProfile(Profile.newBuilder().setProfileName(profileName).setLanguageKey(languageKey).setLanguageName(languageName).setNewRules(1).setUpdatedRules(1).setRemovedRules(1).build());
EmailMessage emailMessage = underTest.format(notification.build());
assertThat(emailMessage.getMessage()).contains("\n 1 new rule\n").contains("\n 1 rule has been updated\n").contains("\n 1 rule removed\n");
}
Aggregations