Changeset 11036 in josm for trunk


Ignore:
Timestamp:
2016-09-21T12:15:15+02:00 (3 years ago)
Author:
simon04
Message:

see #13376 - Fix unit test

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/io/NmeaReaderTest.java

    r10906 r11036  
    2121import org.openstreetmap.josm.data.gpx.WayPoint;
    2222import org.openstreetmap.josm.testutils.JOSMTestRules;
     23import org.openstreetmap.josm.tools.date.DateUtils;
    2324import org.xml.sax.SAXException;
    2425
     
    4849
    4950        final List<WayPoint> wayPoints = new ArrayList<>(in.data.tracks.iterator().next().getSegments().iterator().next().getWayPoints());
    50         assertEquals("2016-01-25T05:05:09.200Z", wayPoints.get(0).get(GpxConstants.PT_TIME));
    51         assertEquals("2016-01-25T05:05:09.400Z", wayPoints.get(1).get(GpxConstants.PT_TIME));
    52         assertEquals("2016-01-25T05:05:09.600Z", wayPoints.get(2).get(GpxConstants.PT_TIME));
     51        assertEquals("2016-01-25T05:05:09.2Z", wayPoints.get(0).get(GpxConstants.PT_TIME));
     52        assertEquals("2016-01-25T05:05:09.4Z", wayPoints.get(1).get(GpxConstants.PT_TIME));
     53        assertEquals("2016-01-25T05:05:09.6Z", wayPoints.get(2).get(GpxConstants.PT_TIME));
     54        assertEquals(wayPoints.get(0).getTime(), DateUtils.fromString(wayPoints.get(0).get(GpxConstants.PT_TIME).toString()));
    5355
    5456        final SimpleDateFormat iso8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
  • trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java

    r10569 r11036  
    111111        assertEquals("2001-09-09T01:46:40Z", DateUtils.fromTimestamp(1000000000));
    112112        assertEquals("2038-01-19T03:14:07Z", DateUtils.fromTimestamp(Integer.MAX_VALUE));
     113    }
     114
     115    /**
     116     * Unit test of {@link DateUtils#fromDate} method.
     117     */
     118    @Test
     119    public void testFromDate() throws Exception {
     120        assertEquals("1970-01-01T00:00:00Z", DateUtils.fromDate(new Date(0)));
     121        assertEquals("1970-01-01T00:00:00.1Z", DateUtils.fromDate(new Date(100)));
     122        assertEquals("1970-01-01T00:00:00.12Z", DateUtils.fromDate(new Date(120)));
     123        assertEquals("1970-01-01T00:00:00.123Z", DateUtils.fromDate(new Date(123)));
     124        assertEquals("2016-01-25T04:05:09Z", DateUtils.fromDate(new Date(1453694709000L)));
    113125    }
    114126
Note: See TracChangeset for help on using the changeset viewer.