Changeset 17715 in josm for trunk/test/unit/org/openstreetmap/josm/data
- Timestamp:
- 2021-04-08T22:56:06+02:00 (4 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/data
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/ImageDataTest.java
r17310 r17715 8 8 9 9 import java.io.File; 10 import java.time.Instant; 10 11 import java.util.ArrayList; 11 12 import java.util.Arrays; 12 13 import java.util.Collections; 13 import java.util.Date;14 14 import java.util.List; 15 15 … … 28 28 class ImageDataTest { 29 29 30 private static ImageEntry newImageEntry(String file, DateexifTime) {30 private static ImageEntry newImageEntry(String file, Instant exifTime) { 31 31 ImageEntry entry = new ImageEntry(new File(file)); 32 32 entry.setExifTime(exifTime); … … 65 65 @Test 66 66 void testSortData() { 67 ImageEntry entry1 = newImageEntry("test1", new Date(1_000_000));68 ImageEntry entry2 = newImageEntry("test2", new Date(2_000_000));67 ImageEntry entry1 = newImageEntry("test1", Instant.ofEpochMilli(1_000_000)); 68 ImageEntry entry2 = newImageEntry("test2", Instant.ofEpochMilli(2_000_000)); 69 69 70 70 ArrayList<ImageEntry> list = new ArrayList<>(); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxDataTest.java
r17275 r17715 10 10 11 11 import java.io.IOException; 12 import java.time.Instant; 12 13 import java.util.ArrayList; 13 14 import java.util.Arrays; … … 337 338 WayPoint p4 = new WayPoint(LatLon.NORTH_POLE); 338 339 WayPoint p5 = new WayPoint(LatLon.NORTH_POLE); 339 p1.set Time(new Date(200020));340 p2.set Time(new Date(100020));341 p4.set Time(new Date(500020));340 p1.setInstant(new Date(200020).toInstant()); 341 p2.setInstant(new Date(100020).toInstant()); 342 p4.setInstant(new Date(500020).toInstant()); 342 343 data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p1, p2)), Collections.emptyMap())); 343 344 data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p3, p4, p5)), Collections.emptyMap())); 344 345 345 Date[] times = data.getMinMaxTimeForAllTracks();346 Instant[] times = data.getMinMaxTimeForAllTracks(); 346 347 assertEquals(times.length, 2); 347 assertEquals( new Date(100020), times[0]);348 assertEquals( new Date(500020), times[1]);348 assertEquals(Instant.ofEpochMilli(100020), times[0]); 349 assertEquals(Instant.ofEpochMilli(500020), times[1]); 349 350 } 350 351 -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxImageCorrelationTest.java
r17275 r17715 58 58 59 59 final GpxImageEntry ib = new GpxImageEntry(); 60 ib.setExifTime(DateUtils. fromString("2016:01:03 11:54:58")); // 5 minutes before start of GPX60 ib.setExifTime(DateUtils.parseInstant("2016:01:03 11:54:58")); // 5 minutes before start of GPX 61 61 ib.createTmp(); 62 62 final GpxImageEntry i0 = new GpxImageEntry(); 63 i0.setExifTime(DateUtils. fromString("2016:01:03 11:59:54")); // 4 sec before start of GPX63 i0.setExifTime(DateUtils.parseInstant("2016:01:03 11:59:54")); // 4 sec before start of GPX 64 64 i0.createTmp(); 65 65 final GpxImageEntry i1 = new GpxImageEntry(); 66 i1.setExifTime(DateUtils. fromString("2016:01:03 12:04:01"));66 i1.setExifTime(DateUtils.parseInstant("2016:01:03 12:04:01")); 67 67 i1.createTmp(); 68 68 final GpxImageEntry i2 = new GpxImageEntry(); 69 i2.setExifTime(DateUtils. fromString("2016:01:03 12:04:57"));69 i2.setExifTime(DateUtils.parseInstant("2016:01:03 12:04:57")); 70 70 i2.createTmp(); 71 71 final GpxImageEntry i3 = new GpxImageEntry(); 72 i3.setExifTime(DateUtils. fromString("2016:01:03 12:05:05"));72 i3.setExifTime(DateUtils.parseInstant("2016:01:03 12:05:05")); 73 73 i3.createTmp(); 74 74 final GpxImageEntry i4 = new GpxImageEntry(); //Image close to two points with elevation, but without time 75 i4.setExifTime(DateUtils. fromString("2016:01:03 12:05:20"));75 i4.setExifTime(DateUtils.parseInstant("2016:01:03 12:05:20")); 76 76 i4.createTmp(); 77 77 final GpxImageEntry i5 = new GpxImageEntry(); //between two tracks, closer to first 78 i5.setExifTime(DateUtils. fromString("2016:01:03 12:07:00"));78 i5.setExifTime(DateUtils.parseInstant("2016:01:03 12:07:00")); 79 79 i5.createTmp(); 80 80 final GpxImageEntry i6 = new GpxImageEntry(); //between two tracks, closer to second (more than 1 minute from any track) 81 i6.setExifTime(DateUtils. fromString("2016:01:03 12:07:45"));81 i6.setExifTime(DateUtils.parseInstant("2016:01:03 12:07:45")); 82 82 i6.createTmp(); 83 83 … … 119 119 assertEquals(null, i6.getElevation()); 120 120 121 assertEquals(null, ib.getGps Time());122 assertEquals(DateUtils. fromString("2016:01:03 11:59:54"), i0.getGpsTime()); // original time is kept123 assertEquals(DateUtils. fromString("2016:01:03 12:04:01"), i1.getGpsTime());124 assertEquals(DateUtils. fromString("2016:01:03 12:04:57"), i2.getGpsTime());125 assertEquals(DateUtils. fromString("2016:01:03 12:05:05"), i3.getGpsTime());121 assertEquals(null, ib.getGpsInstant()); 122 assertEquals(DateUtils.parseInstant("2016:01:03 11:59:54"), i0.getGpsInstant()); // original time is kept 123 assertEquals(DateUtils.parseInstant("2016:01:03 12:04:01"), i1.getGpsInstant()); 124 assertEquals(DateUtils.parseInstant("2016:01:03 12:04:57"), i2.getGpsInstant()); 125 assertEquals(DateUtils.parseInstant("2016:01:03 12:05:05"), i3.getGpsInstant()); 126 126 127 127 clearTmp(images); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/WayPointTest.java
r17275 r17715 5 5 import org.junit.jupiter.api.Test; 6 6 import org.openstreetmap.josm.TestUtils; 7 import org.openstreetmap.josm.data.coor.LatLon; 7 8 import org.openstreetmap.josm.testutils.JOSMTestRules; 8 9 … … 10 11 import nl.jqno.equalsverifier.EqualsVerifier; 11 12 import nl.jqno.equalsverifier.Warning; 13 14 import java.time.Instant; 15 16 import static org.junit.jupiter.api.Assertions.assertEquals; 17 import static org.junit.jupiter.api.Assertions.assertNotEquals; 12 18 13 19 /** … … 37 43 .verify(); 38 44 } 45 46 /** 47 * Unit test of copy constructor {@link WayPoint#WayPoint(WayPoint)} 48 */ 49 @Test 50 void testConstructor() { 51 WayPoint wp1 = new WayPoint(new LatLon(12., 34.)); 52 wp1.setInstant(Instant.ofEpochMilli(123_456_789)); 53 WayPoint wp2 = new WayPoint(wp1); 54 assertEquals(wp1, wp2); 55 assertEquals(wp1.getInstant(), wp2.getInstant()); 56 wp2.setInstant(Instant.ofEpochMilli(234_456_789)); 57 assertNotEquals(wp1, wp2); 58 assertNotEquals(wp1.getInstant(), wp2.getInstant()); 59 } 39 60 }
Note:
See TracChangeset
for help on using the changeset viewer.