Skip to content

Commit 7934c9a

Browse files
committed
Set the current TimeZone in DateConverterImplTest to make it reproducible
1 parent 936e52b commit 7934c9a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

gemma-cli/src/test/java/ubic/gemma/core/util/DateConverterImplTest.java

+15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package ubic.gemma.core.util;
22

3+
import org.junit.AfterClass;
4+
import org.junit.BeforeClass;
35
import org.junit.Test;
46

57
import java.text.ParseException;
@@ -10,6 +12,19 @@
1012

1113
public class DateConverterImplTest {
1214

15+
private static TimeZone tz;
16+
17+
@BeforeClass
18+
public static void setTimeZoneToAmericaVancouver() {
19+
tz = TimeZone.getDefault();
20+
TimeZone.setDefault( TimeZone.getTimeZone( "America/Vancouver" ) );
21+
}
22+
23+
@AfterClass
24+
public static void resetTimeZone() {
25+
TimeZone.setDefault( tz );
26+
}
27+
1328
private final Date relativeTo = new Date();
1429
private final DateConverterImpl c = new DateConverterImpl( relativeTo, TimeZone.getTimeZone( "America/Vancouver" ) );
1530

0 commit comments

Comments
 (0)