Changeset 17912 in josm for trunk/test
- Timestamp:
- 2021-05-24T12:14:00+02:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java
r17712 r17912 244 244 assertNotNull(f1); 245 245 assertNotEquals(f1, f2); 246 DateUtils.PROP_ISO_DATES.put(true); 247 assertEquals("2006-01-02", DateUtils.getDateFormatter(null).format(Instant.parse("2006-01-02T15:04:05.777Z"))); 246 248 } finally { 247 249 DateUtils.PROP_ISO_DATES.put(iso); … … 262 264 assertNotNull(f1); 263 265 assertNotEquals(f1, f2); 266 DateUtils.PROP_ISO_DATES.put(true); 267 assertEquals("15:04:05.777", DateUtils.getTimeFormatter(null).format(Instant.parse("2006-01-02T15:04:05.777Z"))); 268 assertEquals("15:04:05", DateUtils.getTimeFormatter(null).format(Instant.parse("2006-01-02T15:04:05Z"))); 269 assertEquals("15:04:00", DateUtils.getTimeFormatter(null).format(Instant.parse("2006-01-02T15:04:00Z"))); 264 270 } finally { 265 271 DateUtils.PROP_ISO_DATES.put(iso); … … 280 286 @Test 281 287 void testDateTimeFormatter() { 282 Instant instant = Instant.parse("2006-01-02T15:04:05 Z");288 Instant instant = Instant.parse("2006-01-02T15:04:05.777Z"); 283 289 Boolean iso = DateUtils.PROP_ISO_DATES.get(); 284 290 try { … … 290 296 assertNotNull(DateUtils.getTimeFormatter(FormatStyle.SHORT).format(instant)); 291 297 assertNotNull(DateUtils.getDateTimeFormatter(FormatStyle.SHORT, FormatStyle.SHORT).format(instant)); 298 DateUtils.PROP_ISO_DATES.put(true); 299 assertEquals("2006-01-02 15:04:05.777", DateUtils.getDateTimeFormatter(null, null).format(instant)); 300 assertEquals(Instant.parse("2006-01-02T15:04:05.000Z"), 301 DateUtils.getDateTimeFormatter(null, null).parse("2006-01-02 15:04:05", Instant::from)); 302 assertEquals(Instant.parse("2006-01-02T15:04:00.000Z"), 303 DateUtils.getDateTimeFormatter(null, null).parse("2006-01-02 15:04", Instant::from)); 292 304 } finally { 293 305 DateUtils.PROP_ISO_DATES.put(iso);
Note:
See TracChangeset
for help on using the changeset viewer.