diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-12-21 08:19:37 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-12-21 08:19:37 +0000 |
commit | eb9c165c95820c8cef0d0952f20f5b5ecd952b52 (patch) | |
tree | 4de5a0da65ce779e309d4ba1ed776712ec46a02c /sonar-ws-client | |
parent | 1b0e460eba990723abc3f97a5f99b5edfd17dfa0 (diff) | |
download | sonarqube-eb9c165c95820c8cef0d0952f20f5b5ecd952b52.tar.gz sonarqube-eb9c165c95820c8cef0d0952f20f5b5ecd952b52.zip |
fix unit test
Diffstat (limited to 'sonar-ws-client')
-rw-r--r-- | sonar-ws-client/src/test/java/org/sonar/wsclient/services/TimeMachineQueryTest.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/TimeMachineQueryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/TimeMachineQueryTest.java index 86bc13d4542..236e80a44eb 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/TimeMachineQueryTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/TimeMachineQueryTest.java @@ -19,6 +19,7 @@ */ package org.sonar.wsclient.services; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.sonar.wsclient.JdkUtils; @@ -26,16 +27,28 @@ import org.sonar.wsclient.JdkUtils; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.Locale; +import java.util.TimeZone; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; public class TimeMachineQueryTest { + private TimeZone systemTimeZone; + @Before public void before() { + systemTimeZone = TimeZone.getDefault(); + TimeZone.setDefault(TimeZone.getTimeZone("GMT")); WSUtils.setInstance(new JdkUtils()); } + + @After + public void after() { + TimeZone.setDefault(systemTimeZone); + } + @Test public void shouldGetUrl() { TimeMachineQuery query = TimeMachineQuery.createForMetrics("12345", "ncloc", "coverage"); @@ -47,6 +60,6 @@ public class TimeMachineQueryTest { Date from = new SimpleDateFormat("yyyy-MM-dd").parse("2010-02-18"); Date to = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse("2010-03-25 14:59"); TimeMachineQuery query = TimeMachineQuery.createForMetrics("12345", "ncloc").setFrom(from).setTo(to); - assertThat(query.getUrl(), is("/api/timemachine?resource=12345&metrics=ncloc&fromDateTime=2010-02-18T00%3A00%3A00%2B0100&toDateTime=2010-03-25T14%3A59%3A00%2B0100&")); + assertThat(query.getUrl(), is("/api/timemachine?resource=12345&metrics=ncloc&fromDateTime=2010-02-18T00%3A00%3A00%2B0000&toDateTime=2010-03-25T14%3A59%3A00%2B0000&")); } } |