Changeset 11035 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2016-09-20T22:46:47+02:00 (8 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/AutosaveTaskTest.java
r10467 r11035 14 14 import java.nio.file.Files; 15 15 import java.nio.file.Paths; 16 import java.util.Calendar; 16 import java.time.ZoneId; 17 import java.time.ZonedDateTime; 17 18 import java.util.Date; 18 19 import java.util.List; … … 87 88 Files.createDirectories(task.getAutosaveDir()); 88 89 AutosaveLayerInfo info = new AutosaveLayerInfo(new OsmDataLayer(new DataSet(), "layer", null)); 89 Calendar cal = Calendar.getInstance(); 90 cal.set(2016, 0, 1, 1, 2, 3); 91 cal.set(Calendar.MILLISECOND, 456); 92 Date fixed = cal.getTime(); 90 Date fixed = Date.from(ZonedDateTime.of(2016, 1, 1, 1, 2, 3, 456_000_000, ZoneId.systemDefault()).toInstant()); 93 91 94 92 AutosaveTask.PROP_INDEX_LIMIT.put(5); -
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java
r10945 r11035 11 11 12 12 import java.io.StringWriter; 13 import java.time.Instant; 13 14 import java.util.Arrays; 14 import java.util.Calendar;15 15 import java.util.Date; 16 import java.util.GregorianCalendar;17 16 18 17 import org.junit.After; … … 26 25 27 26 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 28 29 27 /** 30 28 * Unit tests for class {@link DataSetMerger}. … … 298 296 public void testNodeSimpleNoIdSemanticallyEqual() { 299 297 300 Calendar cal = GregorianCalendar.getInstance();301 298 User myUser = User.createOsmUser(1111, "my"); 302 299 … … 307 304 n.put("key1", "value1"); 308 305 n.setUser(myUser); 309 n.setTimestamp( cal.getTime());306 n.setTimestamp(new Date()); 310 307 311 308 my.addPrimitive(n); … … 314 311 n1.setCoor(LatLon.ZERO); 315 312 n1.put("key1", "value1"); 316 cal.add(Calendar.HOUR, 1); 317 Date timestamp = cal.getTime(); 318 n1.setTimestamp(timestamp); 313 n1.setTimestamp(Date.from(Instant.now().plusSeconds(3600))); 319 314 n1.setUser(theirUser); 320 315 their.addPrimitive(n1); -
trunk/test/unit/org/openstreetmap/josm/io/ChangesetQueryUrlParserTest.groovy
r10222 r11035 1 1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.io; 3 4 import static org.junit.Assert.* 2 package org.openstreetmap.josm.io 5 3 6 4 import org.junit.Test … … 8 6 import org.openstreetmap.josm.io.ChangesetQuery.ChangesetQueryUrlParser 9 7 8 import java.time.OffsetDateTime 9 import java.time.ZoneOffset 10 10 11 class ChangesetQueryUrlParserTest { 11 12 final shouldFail = new GroovyTestCase().&shouldFail … … 127 128 assert q != null 128 129 assert q.@closedAfter != null 129 Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT+0")); 130 cal.setTime(q.@closedAfter); 131 assert cal.get(Calendar.YEAR) == 2009 132 assert cal.get(Calendar.MONTH) == 11 // calendar is 0-based 133 assert cal.get(Calendar.DAY_OF_MONTH) == 25 134 assert cal.get(Calendar.HOUR_OF_DAY) == 10 135 assert cal.get(Calendar.MINUTE) == 0 136 assert cal.get(Calendar.SECOND) == 0 130 def cal = q.@closedAfter.toInstant().atOffset(ZoneOffset.UTC) 131 assert cal == OffsetDateTime.of(2009, 12, 25, 10, 0, 0, 0, ZoneOffset.UTC) 137 132 138 133 // OK -
trunk/test/unit/org/openstreetmap/josm/tools/ExifReaderTest.java
r10569 r11035 10 10 import java.text.ParseException; 11 11 import java.text.SimpleDateFormat; 12 import java.util.Calendar; 12 import java.time.ZoneId; 13 import java.time.ZonedDateTime; 13 14 import java.util.Date; 14 import java.util.GregorianCalendar;15 15 import java.util.TimeZone; 16 16 … … 24 24 25 25 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 26 27 26 /** 28 27 * EXIF metadata extraction test … … 55 54 public void testReadTime() throws ParseException { 56 55 Date date = ExifReader.readTime(directionSampleFile); 57 assertEquals( new GregorianCalendar(2010, Calendar.MAY, 15, 17, 12, 05).getTime(), date);56 assertEquals(ZonedDateTime.of(2010, 5, 15, 17, 12, 5, 0, ZoneId.systemDefault()).toInstant(), date.toInstant()); 58 57 59 TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin")); 58 final TimeZone zone = TimeZone.getTimeZone("Europe/Berlin"); 59 TimeZone.setDefault(zone); 60 60 date = ExifReader.readTime(directionSampleFile); 61 61 TimeZone.setDefault(DateUtils.UTC); 62 assertEquals( new GregorianCalendar(2010, Calendar.MAY, 15, 15, 12, 05).getTime(), date);62 assertEquals(ZonedDateTime.of(2010, 5, 15, 17, 12, 5, 0, zone.toZoneId()).toInstant(), date.toInstant()); 63 63 } 64 64
Note:
See TracChangeset
for help on using the changeset viewer.