From b226884e6334d06b73005852500a16074e2b3495 Mon Sep 17 00:00:00 2001 From: Daniel Schwarz Date: Mon, 23 Oct 2017 10:49:46 +0200 Subject: SONAR-10008 Make date facet tests independent from the machine's time zone --- .../main/java/org/sonar/api/utils/internal/TestSystem2.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sonar-plugin-api') diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/TestSystem2.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/TestSystem2.java index 11695d31200..2f0e1828fe2 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/TestSystem2.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/TestSystem2.java @@ -19,11 +19,13 @@ */ package org.sonar.api.utils.internal; +import java.util.TimeZone; import org.sonar.api.utils.System2; public class TestSystem2 extends System2 { private long now = 0L; + private TimeZone defaultTimeZone = getDefaultTimeZone(); public TestSystem2 setNow(long l) { this.now = l; @@ -37,4 +39,14 @@ public class TestSystem2 extends System2 { } return now; } + + public TestSystem2 setDefaultTimeZone(TimeZone defaultTimeZone) { + this.defaultTimeZone = defaultTimeZone; + return this; + } + + @Override + public TimeZone getDefaultTimeZone() { + return defaultTimeZone; + } } -- cgit v1.2.3