Ignore:
Timestamp:
2021-04-07T22:34:03+02:00 (4 years ago)
Author:
simon04
Message:

see #14176 - Migrate Note/NoteComment to Instant

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java

    r17275 r17712  
    1010
    1111import java.text.DateFormat;
     12import java.time.Instant;
     13import java.time.format.FormatStyle;
    1214import java.util.Date;
    1315import java.util.Random;
     
    272274        assertNotSame(date, DateUtils.cloneDate(date));
    273275    }
     276
     277    /**
     278     * Unit test of {@link DateUtils#getDateTimeFormatter} method.
     279     */
     280    @Test
     281    void testDateTimeFormatter() {
     282        Instant instant = Instant.parse("2006-01-02T15:04:05Z");
     283        Boolean iso = DateUtils.PROP_ISO_DATES.get();
     284        try {
     285            assertNotNull(DateUtils.getDateFormatter(FormatStyle.SHORT).format(instant));
     286            assertNotNull(DateUtils.getTimeFormatter(FormatStyle.SHORT).format(instant));
     287            assertNotNull(DateUtils.getDateTimeFormatter(FormatStyle.SHORT, FormatStyle.SHORT).format(instant));
     288            DateUtils.PROP_ISO_DATES.put(!iso);
     289            assertNotNull(DateUtils.getDateFormatter(FormatStyle.SHORT).format(instant));
     290            assertNotNull(DateUtils.getTimeFormatter(FormatStyle.SHORT).format(instant));
     291            assertNotNull(DateUtils.getDateTimeFormatter(FormatStyle.SHORT, FormatStyle.SHORT).format(instant));
     292        } finally {
     293            DateUtils.PROP_ISO_DATES.put(iso);
     294        }
     295    }
    274296}
Note: See TracChangeset for help on using the changeset viewer.