summaryrefslogtreecommitdiffstats
path: root/plugins/sonar-core-plugin
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2014-04-23 20:29:35 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2014-04-23 20:29:35 +0200
commit6a565e856b3041aff353a1fb7d896fe5487e5b61 (patch)
tree0f2ae35a89f89e396505dd6e207fb45df2436d50 /plugins/sonar-core-plugin
parentebad62de4864fa13b8f30e766cc6501e3b5ac04f (diff)
downloadsonarqube-6a565e856b3041aff353a1fb7d896fe5487e5b61.tar.gz
sonarqube-6a565e856b3041aff353a1fb7d896fe5487e5b61.zip
Remove some usage of TestUtils
Diffstat (limited to 'plugins/sonar-core-plugin')
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest.java30
1 files changed, 19 insertions, 11 deletions
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest.java
index b94c87630d9..02e00bacb0a 100644
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest.java
+++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest.java
@@ -19,6 +19,8 @@
*/
package org.sonar.plugins.core.issue.notification;
+import com.google.common.io.Resources;
+import org.apache.commons.codec.Charsets;
import org.apache.commons.lang.StringUtils;
import org.junit.Before;
import org.junit.Test;
@@ -30,7 +32,6 @@ import org.sonar.api.notifications.Notification;
import org.sonar.api.user.User;
import org.sonar.api.user.UserFinder;
import org.sonar.plugins.emailnotifications.api.EmailMessage;
-import org.sonar.test.TestUtils;
import static org.fest.assertions.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@@ -69,9 +70,12 @@ public class IssueChangesEmailTemplateTest {
assertThat(email.getSubject()).isEqualTo("Struts, change on issue #ABCDE");
String message = email.getMessage();
- String expectedMessage = TestUtils.getResourceContent("/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest/email_with_assignee_change.txt");
- expectedMessage = StringUtils.remove(expectedMessage, '\r');
- assertThat(message).isEqualTo(expectedMessage);
+ String expected = Resources.toString(Resources.getResource(
+ "org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest/email_with_assignee_change.txt"),
+ Charsets.UTF_8
+ );
+ expected = StringUtils.remove(expected, '\r');
+ assertThat(message).isEqualTo(expected);
assertThat(email.getFrom()).isNull();
}
@@ -86,14 +90,17 @@ public class IssueChangesEmailTemplateTest {
assertThat(email.getSubject()).isEqualTo("Struts, change on issue #ABCDE");
String message = email.getMessage();
- String expectedMessage = TestUtils.getResourceContent("/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest/email_with_action_plan_change.txt");
- expectedMessage = StringUtils.remove(expectedMessage, '\r');
- assertThat(message).isEqualTo(expectedMessage);
+ String expected = Resources.toString(Resources.getResource(
+ "org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest/email_with_action_plan_change.txt"),
+ Charsets.UTF_8
+ );
+ expected = StringUtils.remove(expected, '\r');
+ assertThat(message).isEqualTo(expected);
assertThat(email.getFrom()).isNull();
}
@Test
- public void test_email_with_multiple_changes() {
+ public void test_email_with_multiple_changes() throws Exception {
Notification notification = generateNotification()
.setFieldValue("comment", "How to fix it?")
.setFieldValue("old.assignee", "simon")
@@ -106,9 +113,10 @@ public class IssueChangesEmailTemplateTest {
assertThat(email.getSubject()).isEqualTo("Struts, change on issue #ABCDE");
String message = email.getMessage();
- String expectedMessage = TestUtils.getResourceContent("/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest/email_with_multiple_changes.txt");
- expectedMessage = StringUtils.remove(expectedMessage, '\r');
- assertThat(message).isEqualTo(expectedMessage);
+ String expected = Resources.toString(Resources.getResource(
+ "org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest/email_with_multiple_changes.txt"), Charsets.UTF_8);
+ expected = StringUtils.remove(expected, '\r');
+ assertThat(message).isEqualTo(expected);
assertThat(email.getFrom()).isNull();
}