]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9442 Update notification first sentence and add line breaks
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Fri, 23 Jun 2017 13:12:35 +0000 (15:12 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 29 Jun 2017 15:23:19 +0000 (17:23 +0200)
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/BuiltInQualityProfilesNotificationTemplate.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/BuiltInQualityProfilesNotificationTemplateTest.java
tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java

index e30294c2ada278bb0c2df14dbd44c2a91abb86fb..8572d30e8a154e3651f128deec748ed6573656fc 100644 (file)
@@ -49,8 +49,7 @@ public class BuiltInQualityProfilesNotificationTemplate extends EmailTemplate {
     }
 
     BuiltInQualityProfilesNotification profilesNotification = parse(notification);
-
-    StringBuilder message = new StringBuilder("Built-in quality profiles have been updated:\n");
+    StringBuilder message = new StringBuilder("The following built-in profiles have been updated:\n\n");
     profilesNotification.getProfiles().stream()
       .sorted(Comparator.comparing(Profile::getLanguageName).thenComparing(Profile::getProfileName))
       .forEach(profile -> {
@@ -80,6 +79,7 @@ public class BuiltInQualityProfilesNotificationTemplate extends EmailTemplate {
         if (removedRules > 0) {
           message.append(" ").append(removedRules).append(" rules removed\n");
         }
+        message.append("\n");
       });
 
     message.append("This is a good time to review your quality profiles and update them to benefit from the latest evolutions: ");
index 176a22aa7e747aa45aa076fbbdd00b4af4bfd286..c3514e636a226730ae333cce840b37c7d3aa4b2b 100644 (file)
@@ -169,7 +169,7 @@ public class BuiltInQualityProfilesNotificationTemplateTest {
 
     EmailMessage emailMessage = underTest.format(notification.serialize());
 
-    assertThat(emailMessage.getMessage()).containsSequence("Built-in quality profiles have been updated:\n",
+    assertThat(emailMessage.getMessage()).containsSequence("The following built-in profiles have been updated:\n",
       profileTitleText(profileName1, languageKey1, languageName1),
         " 2 new rules\n",
         profileTitleText(profileName2, languageKey2, languageName2),
@@ -236,9 +236,9 @@ public class BuiltInQualityProfilesNotificationTemplateTest {
   }
 
   private void assertMessage(EmailMessage emailMessage, String expectedProfileDetails) {
-    assertThat(emailMessage.getMessage()).containsSequence("Built-in quality profiles have been updated:\n",
+    assertThat(emailMessage.getMessage()).containsSequence("The following built-in profiles have been updated:\n\n",
       expectedProfileDetails,
-      "This is a good time to review your quality profiles and update them to benefit from the latest evolutions: " + server.getPublicRootUrl() + "/profiles");
+      "\nThis is a good time to review your quality profiles and update them to benefit from the latest evolutions: " + server.getPublicRootUrl() + "/profiles");
   }
 
   private String profileTitleText(String profileName, String languageKey, String languageName) {
index 92a7b8977898b9d9afa8f17f3eb8312f0ce971be..8593dc17a08710b8dc6fe928ea37ea87f77336ee 100644 (file)
@@ -134,7 +134,7 @@ public class BuiltInQualityProfilesNotificationTest {
     String url = orchestrator.getServer().getUrl();
     assertThat(messages.get(0).getMimeMessage().getContent().toString())
       .containsSequence(
-        "Built-in quality profiles have been updated:",
+        "The following built-in profiles have been updated:",
         "\"Basic\" - Foo: " + url + "/profiles/changelog?language=foo&name=Basic&since=", "&to=",
         " 1 new rules",
         " 3 rules have been updated",