/** * Make sure that dates with and without millis can be converted properly into strings * * @throws Exception If there is an exception during the test */ public void testFromDate() throws Exception { // I sure hope this works in other timezones... TimeZone.setDefault(TimeZone.getTimeZone("PST")); final Date date = new Date(123456789012345L); Assert.assertEquals("5882-03-11T00:30:12.345Z", ISO8601.fromDate(date)); final Date dateNoMillis = new Date(123456789012000L); Assert.assertEquals("5882-03-11T00:30:12.000Z", ISO8601.fromDate(dateNoMillis)); }