Changeset 9740 in josm for trunk/test/unit
- Timestamp:
- 2016-02-04T22:18:54+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/io/NmeaReaderTest.java
r9666 r9740 2 2 package org.openstreetmap.josm.io; 3 3 4 import org.junit.Test; 5 import org.openstreetmap.josm.io.NmeaReader.NMEA_TYPE; 4 import static junit.framework.Assert.assertEquals; 5 6 import java.io.FileInputStream; 7 import java.text.SimpleDateFormat; 8 import java.util.ArrayList; 9 import java.util.List; 6 10 7 11 import nl.jqno.equalsverifier.EqualsVerifier; 12 import org.junit.Test; 13 import org.openstreetmap.josm.data.coor.LatLon; 14 import org.openstreetmap.josm.data.gpx.GpxConstants; 15 import org.openstreetmap.josm.data.gpx.WayPoint; 16 import org.openstreetmap.josm.io.NmeaReader.NMEA_TYPE; 8 17 9 18 /** … … 19 28 EqualsVerifier.forClass(NMEA_TYPE.class).verify(); 20 29 } 30 31 /** 32 * Tests reading a nmea file. 33 * @throws Exception if any error occurs 34 */ 35 @Test 36 public void testReader() throws Exception { 37 final NmeaReader in = new NmeaReader(new FileInputStream("data_nodist/btnmeatrack_2016-01-25.nmea")); 38 assertEquals(30, in.getNumberOfCoordinates()); 39 assertEquals(0, in.getParserMalformed()); 40 41 final List<WayPoint> wayPoints = new ArrayList<>(in.data.tracks.iterator().next().getSegments().iterator().next().getWayPoints()); 42 assertEquals("2016-01-25T04:05:09.200Z", wayPoints.get(0).get(GpxConstants.PT_TIME)); 43 assertEquals("2016-01-25T04:05:09.400Z", wayPoints.get(1).get(GpxConstants.PT_TIME)); 44 assertEquals("2016-01-25T04:05:09.600Z", wayPoints.get(2).get(GpxConstants.PT_TIME)); 45 46 final SimpleDateFormat iso8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX"); 47 assertEquals("2016-01-25T05:05:09.200+01", iso8601.format(wayPoints.get(0).getTime())); 48 assertEquals("2016-01-25T05:05:09.400+01", iso8601.format(wayPoints.get(1).getTime())); 49 assertEquals("2016-01-25T05:05:09.600+01", iso8601.format(wayPoints.get(2).getTime())); 50 51 assertEquals(new LatLon(46.98807, -1.400525), wayPoints.get(0).getCoor()); 52 assertEquals("38.9", wayPoints.get(0).get(GpxConstants.PT_ELE)); 53 assertEquals("16", wayPoints.get(0).get(GpxConstants.PT_SAT)); 54 assertEquals("3d", wayPoints.get(0).get(GpxConstants.PT_FIX)); 55 assertEquals("0.7", wayPoints.get(0).get(GpxConstants.PT_HDOP).toString().trim()); 56 assertEquals(null, wayPoints.get(0).get(GpxConstants.PT_VDOP)); 57 assertEquals(null, wayPoints.get(0).get(GpxConstants.PT_PDOP)); 58 } 21 59 }
Note:
See TracChangeset
for help on using the changeset viewer.