Changeset 9383 in josm for trunk/test/unit/org
- Timestamp:
- 2016-01-10T13:04:06+01:00 (9 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java
r8876 r9383 4 4 import static org.junit.Assert.assertEquals; 5 5 6 import java.util.TimeZone; 7 8 import org.junit.BeforeClass; 6 9 import org.junit.Test; 7 10 … … 10 13 */ 11 14 public class DateUtilsTest { 15 16 /** 17 * Setup test. 18 */ 19 @BeforeClass 20 public static void setUp() { 21 TimeZone.setDefault(TimeZone.getTimeZone("GMT+8:00")); 22 } 12 23 13 24 /** … … 26 37 assertEquals(1417298930000L, DateUtils.fromString("2014-11-29 22:08:50 UTC").getTime()); 27 38 } 39 40 /** 41 * Test to parse date as used in EXIF structures. 42 */ 43 @Test 44 public void testExifDate() { 45 assertEquals(1443038712000L - 8 * 3600 * 1000, DateUtils.fromString("2015:09:23 20:05:12").getTime()); 46 assertEquals(1443038712888L - 8 * 3600 * 1000, DateUtils.fromString("2015:09:23 20:05:12.888").getTime()); 47 } 48 49 /** 50 * Test to parse date as used in GPX files 51 */ 52 @Test 53 public void testGPXDate() { 54 assertEquals(1277465405000L, DateUtils.fromString("2010-06-25T11:30:05.000Z").getTime()); 55 } 56 57 /** 58 * Test to parse date as defined in <a href="https://tools.ietf.org/html/rfc3339">RFC 3339</a> 59 */ 60 @Test 61 public void testRfc3339() { 62 // examples taken from RFC 63 assertEquals(482196050520L, DateUtils.fromString("1985-04-12T23:20:50.52Z").getTime()); 64 assertEquals(851042397000L, DateUtils.fromString("1996-12-19T16:39:57-08:00").getTime()); 65 assertEquals(-1041337172130L, DateUtils.fromString("1937-01-01T12:00:27.87+00:20").getTime()); 66 } 28 67 }
Note:
See TracChangeset
for help on using the changeset viewer.