aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-08-16 23:17:49 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2013-08-16 23:17:49 +0200
commit39f367043ff3cb6eb7deaa0edd168073c83da0e7 (patch)
tree48982000bad21b95b9bb6233287c403fc26a9ef4 /plugins
parentc48a643629430e988f8d91740d9f84da8f731935 (diff)
downloadsonarqube-39f367043ff3cb6eb7deaa0edd168073c83da0e7.tar.gz
sonarqube-39f367043ff3cb6eb7deaa0edd168073c83da0e7.zip
Fix tests when timezone is not GMT+2
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplateTest.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplateTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplateTest.java
index f46723272ab..9b3b1deb392 100644
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplateTest.java
+++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplateTest.java
@@ -19,12 +19,15 @@
*/
package org.sonar.plugins.core.issue.notification;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.config.EmailSettings;
import org.sonar.api.notifications.Notification;
import org.sonar.plugins.emailnotifications.api.EmailMessage;
+import java.util.TimeZone;
+
import static org.fest.assertions.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -32,12 +35,20 @@ import static org.mockito.Mockito.when;
public class NewIssuesEmailTemplateTest {
NewIssuesEmailTemplate template;
+ TimeZone initialTimeZone = TimeZone.getDefault();
@Before
public void setUp() {
EmailSettings settings = mock(EmailSettings.class);
when(settings.getServerBaseURL()).thenReturn("http://nemo.sonarsource.org");
template = new NewIssuesEmailTemplate(settings);
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+ }
+
+ @After
+ public void tearDown() {
+ TimeZone.setDefault(initialTimeZone);
+
}
@Test
@@ -64,7 +75,7 @@ public class NewIssuesEmailTemplateTest {
.setFieldValue("count", "32")
.setFieldValue("projectName", "Struts")
.setFieldValue("projectKey", "org.apache:struts")
- .setFieldValue("projectDate", "2010-05-18T16:50:45+0200");
+ .setFieldValue("projectDate", "2010-05-18T14:50:45+0000");
EmailMessage message = template.format(notification);
assertThat(message.getMessageId()).isEqualTo("new-issues/org.apache:struts");
@@ -73,7 +84,7 @@ public class NewIssuesEmailTemplateTest {
"Project: Struts\n" +
"32 new issues\n" +
"\n" +
- "See it in SonarQube: http://nemo.sonarsource.org/issues/search?componentRoots=org.apache%3Astruts&createdAt=2010-05-18T16%3A50%3A45%2B0200\n");
+ "See it in SonarQube: http://nemo.sonarsource.org/issues/search?componentRoots=org.apache%3Astruts&createdAt=2010-05-18T14%3A50%3A45%2B0000\n");
}
@Test