Ignore:
Timestamp:
2016-01-10T18:06:13+01:00 (4 years ago)
Author:
simon04
Message:

Fix timezone aware unit tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java

    r9385 r9394  
    44import static org.junit.Assert.assertEquals;
    55
    6 import java.util.Date;
    76import java.util.TimeZone;
    87
     
    1716
    1817    /**
    19      * Setup test.
     18     * Allows to override the timezone used in {@link DateUtils} for unit tests.
     19     * @param zone the timezone to use
    2020     */
    21     @BeforeClass
    22     public static void setUp() {
    23         TimeZone.setDefault(TimeZone.getTimeZone("GMT+8:00"));
     21    public static void setTimeZone(TimeZone zone) {
     22        DateUtils.setTimeZone(zone);
    2423    }
    2524
     
    4544    @Test
    4645    public void testExifDate() {
     46        setTimeZone(TimeZone.getTimeZone("GMT+8:00")); // parsing is timezone aware
    4747        assertEquals(1443038712000L - 8 * 3600 * 1000, DateUtils.fromString("2015:09:23 20:05:12").getTime());
    4848        assertEquals(1443038712888L - 8 * 3600 * 1000, DateUtils.fromString("2015:09:23 20:05:12.888").getTime());
Note: See TracChangeset for help on using the changeset viewer.