Changeset 17838 in josm for trunk/test/unit
- Timestamp:
- 2021-05-01T11:39:00+02:00 (4 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetDataSetTest.java
r17275 r17838 7 7 import static org.junit.jupiter.api.Assertions.fail; 8 8 9 import java. util.Date;9 import java.time.Instant; 10 10 import java.util.Iterator; 11 11 … … 40 40 void testIterator() { 41 41 final ChangesetDataSet cds = new ChangesetDataSet(); 42 HistoryNode prim1 = new HistoryNode(1, 1, true, User.getAnonymous(), 1, new Date(), LatLon.ZERO);42 HistoryNode prim1 = new HistoryNode(1, 1, true, User.getAnonymous(), 1, Instant.now(), LatLon.ZERO); 43 43 cds.put(prim1, ChangesetModificationType.CREATED); 44 44 Iterator<ChangesetDataSetEntry> it = cds.iterator(); … … 62 62 void testGetEntry() { 63 63 final ChangesetDataSet cds = new ChangesetDataSet(); 64 HistoryNode prim1 = new HistoryNode(1, 1, true, User.getAnonymous(), 1, new Date(), LatLon.ZERO);64 HistoryNode prim1 = new HistoryNode(1, 1, true, User.getAnonymous(), 1, Instant.now(), LatLon.ZERO); 65 65 cds.put(prim1, ChangesetModificationType.CREATED); 66 HistoryNode prim2 = new HistoryNode(1, 2, true, User.getAnonymous(), 1, new Date(), LatLon.ZERO);66 HistoryNode prim2 = new HistoryNode(1, 2, true, User.getAnonymous(), 1, Instant.now(), LatLon.ZERO); 67 67 prim2.put("highway", "stop"); 68 68 cds.put(prim2, ChangesetModificationType.UPDATED); 69 69 assertEquals(prim1, cds.getFirstEntry(prim1.getPrimitiveId()).getPrimitive()); 70 70 assertEquals(prim2, cds.getLastEntry(prim1.getPrimitiveId()).getPrimitive()); 71 HistoryNode prim3 = new HistoryNode(1, 3, false, User.getAnonymous(), 1, new Date(), null);71 HistoryNode prim3 = new HistoryNode(1, 3, false, User.getAnonymous(), 1, Instant.now(), null); 72 72 73 73 cds.put(prim3, ChangesetModificationType.DELETED); -
trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryNodeTest.java
r17275 r17838 5 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 import java. util.Date;7 import java.time.Instant; 8 8 import java.util.HashMap; 9 9 import java.util.Map; … … 32 32 public JOSMTestRules test = new JOSMTestRules(); 33 33 34 private static HistoryNode create( Dated) {34 private static HistoryNode create(Instant d) { 35 35 return new HistoryNode( 36 36 1L, // id … … 49 49 @Test 50 50 void testHistoryNode() { 51 Date d = new Date();51 Instant d = Instant.now(); 52 52 HistoryNode node = create(d); 53 53 … … 58 58 assertEquals(3, node.getUser().getId()); 59 59 assertEquals(4, node.getChangesetId()); 60 assertEquals(d, node.get Timestamp());60 assertEquals(d, node.getInstant()); 61 61 } 62 62 … … 66 66 @Test 67 67 void testGetType() { 68 assertEquals(OsmPrimitiveType.NODE, create( new Date()).getType());68 assertEquals(OsmPrimitiveType.NODE, create(Instant.now()).getType()); 69 69 } 70 70 … … 86 86 @Test 87 87 void testGetDisplayName() { 88 HistoryNode node = create( new Date());88 HistoryNode node = create(Instant.now()); 89 89 HistoryNameFormatter hnf = DefaultNameFormatter.getInstance(); 90 90 assertEquals("1 (0.0, 0.0)", node.getDisplayName(hnf)); -
trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryRelationTest.java
r17275 r17838 5 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 import java. util.Date;7 import java.time.Instant; 8 8 import java.util.HashMap; 9 9 import java.util.Map; … … 31 31 public JOSMTestRules test = new JOSMTestRules(); 32 32 33 private static HistoryRelation create( Dated) {33 private static HistoryRelation create(Instant d) { 34 34 return new HistoryRelation( 35 35 1, // id … … 47 47 @Test 48 48 void testHistoryRelation() { 49 Date d = new Date();49 Instant d = Instant.now(); 50 50 HistoryRelation rel = create(d); 51 51 … … 56 56 assertEquals(3, rel.getUser().getId()); 57 57 assertEquals(4, rel.getChangesetId()); 58 assertEquals(d, rel.get Timestamp());58 assertEquals(d, rel.getInstant()); 59 59 } 60 60 … … 64 64 @Test 65 65 void testGetType() { 66 assertEquals(OsmPrimitiveType.RELATION, create( new Date()).getType());66 assertEquals(OsmPrimitiveType.RELATION, create(Instant.now()).getType()); 67 67 } 68 68 … … 73 73 void testGetDisplayName() { 74 74 HistoryNameFormatter hnf = DefaultNameFormatter.getInstance(); 75 HistoryRelation rel0 = create( new Date()); // 0 member76 HistoryRelation rel1 = create( new Date()); // 1 member77 HistoryRelation rel2 = create( new Date()); // 2 members75 HistoryRelation rel0 = create(Instant.now()); // 0 member 76 HistoryRelation rel1 = create(Instant.now()); // 1 member 77 HistoryRelation rel2 = create(Instant.now()); // 2 members 78 78 79 79 rel1.addMember(new RelationMemberData(null, OsmPrimitiveType.NODE, 1)); -
trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryWayTest.java
r17275 r17838 6 6 import static org.junit.jupiter.api.Assertions.fail; 7 7 8 import java. util.Date;8 import java.time.Instant; 9 9 import java.util.HashMap; 10 10 import java.util.List; … … 33 33 public JOSMTestRules test = new JOSMTestRules(); 34 34 35 private static HistoryWay create( Dated) {35 private static HistoryWay create(Instant d) { 36 36 return new HistoryWay( 37 37 1, // id … … 49 49 @Test 50 50 void testHistoryWay() { 51 Date d = new Date();51 Instant d = Instant.now(); 52 52 HistoryWay way = create(d); 53 53 … … 58 58 assertEquals(3, way.getUser().getId()); 59 59 assertEquals(4, way.getChangesetId()); 60 assertEquals(d, way.get Timestamp());60 assertEquals(d, way.getInstant()); 61 61 62 62 assertEquals(0, way.getNumNodes()); … … 68 68 @Test 69 69 void testGetType() { 70 assertEquals(OsmPrimitiveType.WAY, create( new Date()).getType());70 assertEquals(OsmPrimitiveType.WAY, create(Instant.now()).getType()); 71 71 } 72 72 73 73 @Test 74 74 void testNodeManipulation() { 75 HistoryWay way = create( new Date());75 HistoryWay way = create(Instant.now()); 76 76 77 77 way.addNode(1); … … 93 93 @Test 94 94 void testIterating() { 95 HistoryWay way = create( new Date());95 HistoryWay way = create(Instant.now()); 96 96 97 97 way.addNode(1); … … 110 110 void testGetDisplayName() { 111 111 HistoryNameFormatter hnf = DefaultNameFormatter.getInstance(); 112 HistoryWay way0 = create( new Date()); // no node113 HistoryWay way1 = create( new Date()); // 1 node114 HistoryWay way2 = create( new Date()); // 2 nodes112 HistoryWay way0 = create(Instant.now()); // no node 113 HistoryWay way1 = create(Instant.now()); // 1 node 114 HistoryWay way2 = create(Instant.now()); // 2 nodes 115 115 116 116 way1.addNode(1); -
trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserDialogTest.java
r17275 r17838 4 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 import java. util.Date;6 import java.time.Instant; 7 7 8 8 import org.junit.jupiter.api.extension.RegisterExtension; … … 15 15 import org.openstreetmap.josm.data.osm.history.HistoryWay; 16 16 import org.openstreetmap.josm.testutils.JOSMTestRules; 17 import org.openstreetmap.josm.tools.date.DateUtils;18 17 19 18 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 38 37 HistoryDataSet hds = new HistoryDataSet(); 39 38 User user = User.createOsmUser(1, ""); 40 Date date = DateUtils.fromString("2016-01-01");39 Instant date = Instant.parse("2016-01-01T00:00:00Z"); 41 40 hds.put(new HistoryNode(1, 1, true, user, 1, date, null)); 42 41 assertEquals("History for node 1", HistoryBrowserDialog.buildTitle(hds.getHistory(1, OsmPrimitiveType.NODE))); -
trunk/test/unit/org/openstreetmap/josm/io/OsmChangesetContentParserTest.java
r17275 r17838 116 116 assertEquals(1, p.getVersion()); 117 117 assertEquals(1, p.getChangesetId()); 118 assertNotNull(p.get Timestamp());118 assertNotNull(p.getInstant()); 119 119 assertEquals(ChangesetModificationType.CREATED, ds.getModificationType(p.getPrimitiveId())); 120 120 assertTrue(ds.isCreated(p.getPrimitiveId())); … … 146 146 assertEquals(1, p.getVersion()); 147 147 assertEquals(1, p.getChangesetId()); 148 assertNotNull(p.get Timestamp());148 assertNotNull(p.getInstant()); 149 149 assertEquals(ChangesetModificationType.UPDATED, ds.getModificationType(p.getPrimitiveId())); 150 150 assertTrue(ds.isUpdated(p.getPrimitiveId())); … … 176 176 assertEquals(1, p.getVersion()); 177 177 assertEquals(1, p.getChangesetId()); 178 assertNotNull(p.get Timestamp());178 assertNotNull(p.getInstant()); 179 179 assertEquals(ChangesetModificationType.DELETED, ds.getModificationType(p.getPrimitiveId())); 180 180 assertTrue(ds.isDeleted(p.getPrimitiveId())); … … 218 218 assertEquals(1, p.getVersion()); 219 219 assertEquals(1, p.getChangesetId()); 220 assertNotNull(p.get Timestamp());220 assertNotNull(p.getInstant()); 221 221 assertEquals(ChangesetModificationType.CREATED, ds.getModificationType(p.getPrimitiveId())); 222 222 assertTrue(ds.isCreated(p.getPrimitiveId())); … … 228 228 assertEquals(2, w.getVersion()); 229 229 assertEquals(1, w.getChangesetId()); 230 assertNotNull(w.get Timestamp());230 assertNotNull(w.getInstant()); 231 231 assertEquals(ChangesetModificationType.UPDATED, ds.getModificationType(w.getPrimitiveId())); 232 232 assertTrue(ds.isUpdated(w.getPrimitiveId())); … … 239 239 assertEquals(3, r.getVersion()); 240 240 assertEquals(1, r.getChangesetId()); 241 assertNotNull(r.get Timestamp());241 assertNotNull(r.getInstant()); 242 242 assertEquals(ChangesetModificationType.DELETED, ds.getModificationType(r.getPrimitiveId())); 243 243 assertTrue(ds.isDeleted(r.getPrimitiveId())); -
trunk/test/unit/org/openstreetmap/josm/io/OsmServerHistoryReaderTest.java
r17194 r17838 17 17 18 18 import com.github.tomakehurst.wiremock.junit.WireMockRule; 19 20 import java.time.Instant; 19 21 20 22 /** … … 50 52 assertEquals(1, h.getLatest().getNumKeys()); 51 53 assertEquals(65565982, h.getLatest().getChangesetId()); 52 assertEquals( 1545089885000L, h.getLatest().getTimestamp().getTime());54 assertEquals(Instant.ofEpochMilli(1545089885000L), h.getLatest().getInstant()); 53 55 } 54 56 … … 65 67 assertEquals(10, h.getLatest().getNumKeys()); 66 68 assertEquals(26368284, h.getLatest().getChangesetId()); 67 assertEquals( 1414429134000L, h.getLatest().getTimestamp().getTime());69 assertEquals(Instant.ofEpochMilli(1414429134000L), h.getLatest().getInstant()); 68 70 } 69 71 … … 80 82 assertEquals(0, h.getLatest().getNumKeys()); 81 83 assertEquals(486501, h.getLatest().getChangesetId()); 82 assertEquals( 1194886166000L, h.getLatest().getTimestamp().getTime());84 assertEquals(Instant.ofEpochMilli(1194886166000L), h.getLatest().getInstant()); 83 85 } 84 86 }
Note:
See TracChangeset
for help on using the changeset viewer.