From b103c3a4830a88a0721456571e7472dd6a96b054 Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Wed, 27 Jul 2011 17:09:15 +0400 Subject: [PATCH] SONAR-2607 Fix permalink in ReviewEmailTemplate --- .../reviews/ReviewEmailTemplate.java | 2 +- .../reviews/ReviewEmailTemplateTest.java | 70 ++++++++++++++++--- 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplate.java b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplate.java index f09082a2d07..00c68c11dd8 100644 --- a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplate.java +++ b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplate.java @@ -97,7 +97,7 @@ public class ReviewEmailTemplate extends EmailTemplate { private void appendFooter(StringBuilder sb, Notification notification) { String reviewId = notification.getFieldValue("reviewId"); sb.append("\n--\n") - .append("See it in Sonar: ").append(configuration.getServerBaseURL()).append("/review/view/").append(reviewId).append('\n'); + .append("See it in Sonar: ").append(configuration.getServerBaseURL()).append("/reviews/view/").append(reviewId).append('\n'); } /** diff --git a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplateTest.java b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplateTest.java index 70fca60f6b8..b217f3d2585 100644 --- a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplateTest.java +++ b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplateTest.java @@ -72,7 +72,12 @@ public class ReviewEmailTemplateTest { assertThat(message.getMessageId(), is("review/1")); assertThat(message.getSubject(), is("Review #1")); assertThat(message.getFrom(), is("Freddy Mallet")); - assertThat(message.getMessage(), is("Comment:\n This is my first comment\n\n--\nSee it in Sonar: http://nemo.sonarsource.org/review/view/1\n")); + assertThat(message.getMessage(), is("" + + "Comment:\n" + + " This is my first comment\n" + + "\n" + + "--\n" + + "See it in Sonar: http://nemo.sonarsource.org/reviews/view/1\n")); } /** @@ -100,7 +105,14 @@ public class ReviewEmailTemplateTest { assertThat(message.getMessageId(), is("review/1")); assertThat(message.getSubject(), is("Review #1")); assertThat(message.getFrom(), is("Freddy Mallet")); - assertThat(message.getMessage(), is("Comment:\n This is another comment\nWas:\n This is my first comment\n\n--\nSee it in Sonar: http://nemo.sonarsource.org/review/view/1\n")); + assertThat(message.getMessage(), is("" + + "Comment:\n" + + " This is another comment\n" + + "Was:\n" + + " This is my first comment\n" + + "\n" + + "--\n" + + "See it in Sonar: http://nemo.sonarsource.org/reviews/view/1\n")); } /** @@ -126,7 +138,12 @@ public class ReviewEmailTemplateTest { assertThat(message.getMessageId(), is("review/1")); assertThat(message.getSubject(), is("Review #1")); assertThat(message.getFrom(), is("Freddy Mallet")); - assertThat(message.getMessage(), is("Comment deleted, was:\n This is deleted comment\n\n--\nSee it in Sonar: http://nemo.sonarsource.org/review/view/1\n")); + assertThat(message.getMessage(), is("" + + "Comment deleted, was:\n" + + " This is deleted comment\n" + + "\n" + + "--\n" + + "See it in Sonar: http://nemo.sonarsource.org/reviews/view/1\n")); } /** @@ -151,7 +168,11 @@ public class ReviewEmailTemplateTest { assertThat(message.getMessageId(), is("review/1")); assertThat(message.getSubject(), is("Review #1")); assertThat(message.getFrom(), is("Freddy Mallet")); - assertThat(message.getMessage(), is("Assignee: Evgeny Mandrikov\n\n--\nSee it in Sonar: http://nemo.sonarsource.org/review/view/1\n")); + assertThat(message.getMessage(), is("" + + "Assignee: Evgeny Mandrikov\n" + + "\n" + + "--\n" + + "See it in Sonar: http://nemo.sonarsource.org/reviews/view/1\n")); } /** @@ -176,7 +197,11 @@ public class ReviewEmailTemplateTest { assertThat(message.getMessageId(), is("review/1")); assertThat(message.getSubject(), is("Review #1")); assertThat(message.getFrom(), is("Freddy Mallet")); - assertThat(message.getMessage(), is("Assignee: Simon Brandhof (was Evgeny Mandrikov)\n\n--\nSee it in Sonar: http://nemo.sonarsource.org/review/view/1\n")); + assertThat(message.getMessage(), is("" + + "Assignee: Simon Brandhof (was Evgeny Mandrikov)\n" + + "\n" + + "--\n" + + "See it in Sonar: http://nemo.sonarsource.org/reviews/view/1\n")); } /** @@ -201,7 +226,11 @@ public class ReviewEmailTemplateTest { assertThat(message.getMessageId(), is("review/1")); assertThat(message.getSubject(), is("Review #1")); assertThat(message.getFrom(), is("Freddy Mallet")); - assertThat(message.getMessage(), is("Assignee: (was Simon Brandhof)\n\n--\nSee it in Sonar: http://nemo.sonarsource.org/review/view/1\n")); + assertThat(message.getMessage(), is("" + + "Assignee: (was Simon Brandhof)\n" + + "\n" + + "--\n" + + "See it in Sonar: http://nemo.sonarsource.org/reviews/view/1\n")); } /** @@ -225,7 +254,11 @@ public class ReviewEmailTemplateTest { assertThat(message.getMessageId(), is("review/1")); assertThat(message.getSubject(), is("Review #1")); assertThat(message.getFrom(), nullValue()); - assertThat(message.getMessage(), is("Status: CLOSED (was OPEN)\n\n--\nSee it in Sonar: http://nemo.sonarsource.org/review/view/1\n")); + assertThat(message.getMessage(), is("" + + "Status: CLOSED (was OPEN)\n" + + "\n" + + "--\n" + + "See it in Sonar: http://nemo.sonarsource.org/reviews/view/1\n")); } /** @@ -252,7 +285,12 @@ public class ReviewEmailTemplateTest { assertThat(message.getMessageId(), is("review/1")); assertThat(message.getSubject(), is("Review #1")); assertThat(message.getFrom(), nullValue()); - assertThat(message.getMessage(), is("Status: REOPENED (was RESOLVED)\nResolution: (was FIXED)\n\n--\nSee it in Sonar: http://nemo.sonarsource.org/review/view/1\n")); + assertThat(message.getMessage(), is("" + + "Status: REOPENED (was RESOLVED)\n" + + "Resolution: (was FIXED)\n" + + "\n" + + "--\n" + + "See it in Sonar: http://nemo.sonarsource.org/reviews/view/1\n")); } /** @@ -280,7 +318,12 @@ public class ReviewEmailTemplateTest { assertThat(message.getMessageId(), is("review/1")); assertThat(message.getSubject(), is("Review #1")); assertThat(message.getFrom(), is("Simon Brandhof")); - assertThat(message.getMessage(), is("Status: RESOLVED (was OPEN)\nResolution: FIXED\n\n--\nSee it in Sonar: http://nemo.sonarsource.org/review/view/1\n")); + assertThat(message.getMessage(), is("" + + "Status: RESOLVED (was OPEN)\n" + + "Resolution: FIXED\n" + + "\n" + + "--\n" + + "See it in Sonar: http://nemo.sonarsource.org/reviews/view/1\n")); } /** @@ -311,7 +354,14 @@ public class ReviewEmailTemplateTest { assertThat(message.getMessageId(), is("review/1")); assertThat(message.getSubject(), is("Review #1")); assertThat(message.getFrom(), is("Freddy Mallet")); - assertThat(message.getMessage(), is("Status: RESOLVED (was REOPENED)\nResolution: FALSE-POSITIVE\nComment:\n Because!\n\n--\nSee it in Sonar: http://nemo.sonarsource.org/review/view/1\n")); + assertThat(message.getMessage(), is("" + + "Status: RESOLVED (was REOPENED)\n" + + "Resolution: FALSE-POSITIVE\n" + + "Comment:\n" + + " Because!\n" + + "\n" + + "--\n" + + "See it in Sonar: http://nemo.sonarsource.org/reviews/view/1\n")); } @Test -- 2.39.5