Changeset 17749 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2021-04-11T21:56:50+02:00 (4 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java
r17346 r17749 14 14 import java.time.Instant; 15 15 import java.util.Arrays; 16 import java.util.Date;17 16 18 17 import org.junit.jupiter.api.AfterEach; … … 25 24 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 26 25 import org.openstreetmap.josm.testutils.JOSMTestRules; 27 import org.openstreetmap.josm.tools.date.DateUtils;28 26 29 27 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 307 305 n.put("key1", "value1"); 308 306 n.setUser(myUser); 309 n.set Timestamp(new Date());307 n.setInstant(Instant.now()); 310 308 311 309 my.addPrimitive(n); … … 314 312 n1.setCoor(LatLon.ZERO); 315 313 n1.put("key1", "value1"); 316 n1.set Timestamp(Date.from(Instant.now().plusSeconds(3600)));314 n1.setInstant(Instant.now().plusSeconds(3600)); 317 315 n1.setUser(theirUser); 318 316 their.addPrimitive(n1); … … 346 344 n1.setOsmId(1, 1); 347 345 n1.put("key1", "value1"); 348 n1.set Timestamp(new Date());346 n1.setInstant(Instant.now()); 349 347 their.addPrimitive(n1); 350 348 … … 646 644 User user = User.createOsmUser(1111, "their"); 647 645 theirWay.setUser(user); 648 theirWay.set Timestamp(new Date());646 theirWay.setInstant(Instant.now()); 649 647 their.addPrimitive(theirWay); 650 648 … … 699 697 User user = User.createOsmUser(1111, "their"); 700 698 theirWay.setUser(user); 701 theirWay.set Timestamp(new Date());699 theirWay.setInstant(Instant.now()); 702 700 their.addPrimitive(theirWay); 703 701 … … 754 752 theirWay.addNode(tn3); 755 753 theirWay.setUser(User.createOsmUser(1111, "their")); 756 theirWay.set Timestamp(new Date());754 theirWay.setInstant(Instant.now()); 757 755 their.addPrimitive(theirWay); 758 756 … … 1182 1180 Node nA = new Node(2848219691L, 1); 1183 1181 nA.setCoor(LatLon.ZERO); 1184 nA.set Timestamp(DateUtils.fromString("2014-05-10T14:25:40Z"));1182 nA.setInstant(Instant.parse("2014-05-10T14:25:40Z")); 1185 1183 nA.setChangesetId(22251108); 1186 1184 nA.setUser(User.createOsmUser(385987, "yaho")); -
trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java
r17746 r17749 13 13 import java.nio.file.Files; 14 14 import java.nio.file.Paths; 15 import java.time.Instant; 15 16 import java.util.Arrays; 16 17 import java.util.Collection; … … 44 45 import org.openstreetmap.josm.testutils.JOSMTestRules; 45 46 import org.openstreetmap.josm.tools.Logging; 46 import org.openstreetmap.josm.tools.date.DateUtils;47 47 48 48 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 449 449 void testTimestamp() throws SearchParseError { 450 450 final Node n1 = new Node(); 451 n1.set Timestamp(DateUtils.fromString("2010-01-22"));451 n1.setInstant(Instant.parse("2010-01-22T00:00:00Z")); 452 452 assertTrue(SearchCompiler.compile("timestamp:2010/2011").match(n1)); 453 453 assertTrue(SearchCompiler.compile("timestamp:2010-01/2011").match(n1)); … … 455 455 assertFalse(SearchCompiler.compile("timestamp:2010-01-23/2011").match(n1)); 456 456 assertFalse(SearchCompiler.compile("timestamp:2010/2010-01-21").match(n1)); 457 n1.set Timestamp(DateUtils.fromString("2016-01-22"));457 n1.setInstant(Instant.parse("2016-01-22T00:00:00Z")); 458 458 assertFalse(SearchCompiler.compile("timestamp:2010/2011").match(n1)); 459 459 } -
trunk/test/unit/org/openstreetmap/josm/io/OsmJsonReaderTest.java
r17275 r17749 9 9 import java.io.InputStream; 10 10 import java.nio.charset.StandardCharsets; 11 import java.time.Instant; 11 12 import java.util.Iterator; 12 13 … … 131 132 assertEquals(1, n.getUniqueId()); 132 133 assertEquals(new LatLon(2.0, -3.0), n.getCoor()); 133 assertEquals( "2018-01-01T00:00:00Z", DateUtils.newIsoDateTimeFormat().format(n.getTimestamp()));134 assertEquals(Instant.parse("2018-01-01T00:00:00Z"), n.getInstant()); 134 135 assertEquals(4, n.getVersion()); 135 136 assertEquals(5, n.getChangesetId()); -
trunk/test/unit/org/openstreetmap/josm/io/OsmWriterTest.java
r17717 r17749 24 24 import org.openstreetmap.josm.data.osm.DataSet; 25 25 import org.openstreetmap.josm.data.osm.DownloadPolicy; 26 import org.openstreetmap.josm.data.osm.INode; 27 import org.openstreetmap.josm.data.osm.Node; 26 28 import org.openstreetmap.josm.data.osm.NodeData; 27 29 import org.openstreetmap.josm.data.osm.UploadPolicy; … … 127 129 } 128 130 } 131 132 /** 133 * Unit test of {@link OsmWriter#visit(INode)}. 134 * @throws IOException if an I/O error occurs 135 */ 136 @Test 137 void testNode() throws IOException { 138 Node node = new Node(1, 42); 139 node.setCoor(new LatLon(12., 34.)); 140 node.setInstant(Instant.parse("2006-05-10T18:27:47Z")); 141 try (StringWriter stringWriter = new StringWriter(); 142 OsmWriter osmWriter = OsmWriterFactory.createOsmWriter(new PrintWriter(stringWriter), true, OsmWriter.DEFAULT_API_VERSION)) { 143 osmWriter.visit(node); 144 assertEquals(" <node id='1' timestamp='2006-05-10T18:27:47Z' visible='true' version='42' lat='12.0' lon='34.0' />\n", 145 stringWriter.toString().replace("\r", "")); 146 } 147 } 129 148 }
Note:
See TracChangeset
for help on using the changeset viewer.