From 702293fda39d243d02fbc342682f9a20b640137e Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Thu, 22 Jun 2017 16:56:15 +0200 Subject: [PATCH] SONAR-9442 Update notification email by adding comma before urls --- .../BuiltInQualityProfilesNotificationTemplate.java | 4 ++-- .../BuiltInQualityProfilesNotificationTemplateTest.java | 8 ++++---- .../BuiltInQualityProfilesNotificationTest.java | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/BuiltInQualityProfilesNotificationTemplate.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/BuiltInQualityProfilesNotificationTemplate.java index c03fa96486f..3f64a96c170 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/BuiltInQualityProfilesNotificationTemplate.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/BuiltInQualityProfilesNotificationTemplate.java @@ -58,7 +58,7 @@ public class BuiltInQualityProfilesNotificationTemplate extends EmailTemplate { .append(profile.getProfileName()) .append("\" - ") .append(profile.getLanguageName()) - .append(" ") + .append(": ") .append(server.getPublicRootUrl()).append("/profiles/changelog?language=") .append(profile.getLanguageKey()) .append("&name=") @@ -82,7 +82,7 @@ public class BuiltInQualityProfilesNotificationTemplate extends EmailTemplate { } }); - message.append("This is a good time to review your quality profiles and update them to benefit from the latest evolutions. "); + message.append("This is a good time to review your quality profiles and update them to benefit from the latest evolutions: "); message.append(server.getPublicRootUrl()).append("/profiles"); // And finally return the email that will be sent diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/BuiltInQualityProfilesNotificationTemplateTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/BuiltInQualityProfilesNotificationTemplateTest.java index 8cfdfc97f51..89f023a1645 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/BuiltInQualityProfilesNotificationTemplateTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/BuiltInQualityProfilesNotificationTemplateTest.java @@ -156,7 +156,7 @@ public class BuiltInQualityProfilesNotificationTemplateTest { " 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"); + "This is a good time to review your quality profiles and update them to benefit from the latest evolutions: " + server.getPublicRootUrl() + "/profiles"); } @Test @@ -220,15 +220,15 @@ public class BuiltInQualityProfilesNotificationTemplateTest { private void assertMessage(EmailMessage emailMessage, String expectedProfileDetails) { assertThat(emailMessage.getMessage()).containsSequence("Built-in quality profiles have been updated:\n", expectedProfileDetails, - "This is a good time to review your quality profiles and update them to benefit from the latest evolutions. " + server.getPublicRootUrl() + "/profiles"); + "This 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) { - return "\"" + profileName + "\" - " + languageName + " " + server.getPublicRootUrl() + "/profiles/changelog?language=" + languageKey + "&name=" + profileName; + return "\"" + profileName + "\" - " + languageName + ": " + server.getPublicRootUrl() + "/profiles/changelog?language=" + languageKey + "&name=" + profileName; } private String profileTitleText(String profileName, String languageKey, String languageName, String startDate, String endDate) { - return "\"" + profileName + "\" - " + languageName + " " + server.getPublicRootUrl() + "/profiles/changelog?language=" + languageKey + "&name=" + profileName + + return "\"" + profileName + "\" - " + languageName + ": " + server.getPublicRootUrl() + "/profiles/changelog?language=" + languageKey + "&name=" + profileName + "&since=" + startDate + "&to=" + endDate + "\n"; } diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java index c2f2e343564..54077419d60 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java @@ -139,11 +139,11 @@ public class BuiltInQualityProfilesNotificationTest { assertThat(messages.get(0).getMimeMessage().getContent().toString()) .containsSequence( "Built-in quality profiles have been updated:", - "\"Basic\" - Foo " + url + "/profiles/changelog?language=foo&name=Basic&since=", "&to=", + "\"Basic\" - Foo: " + url + "/profiles/changelog?language=foo&name=Basic&since=", "&to=", " 1 new rules", " 3 rules have been updated", " 1 rules removed", - "This is a good time to review your quality profiles and update them to benefit from the latest evolutions. " + url + "/profiles") + "This is a good time to review your quality profiles and update them to benefit from the latest evolutions: " + url + "/profiles") .isEqualTo(messages.get(1).getMimeMessage().getContent().toString()); } -- 2.39.5