Changeset 19055 in josm for trunk/test/unit
- Timestamp:
- 2024-04-23T18:41:05+02:00 (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java
r19054 r19055 24 24 import org.openstreetmap.josm.testutils.annotations.I18n; 25 25 import org.openstreetmap.josm.tools.UncheckedParseException; 26 import org.openstreetmap.josm.tools.Utils; 26 27 27 28 import net.trajano.commons.testing.UtilityClassTestUtil; … … 153 154 @Test 154 155 void testFormatTime() { 155 assertEquals("12:00 AM", DateUtils.formatTime(new Date(0), DateFormat.SHORT)); 156 assertEquals("1:00 AM", DateUtils.formatTime(new Date(60 * 60 * 1000), DateFormat.SHORT)); 157 assertEquals("12:00 AM", DateUtils.formatTime(new Date(999), DateFormat.SHORT)); 156 // Somewhere between Java 17 and Java 21, a non-breaking space replaced the original space between the time and AM/PM. 157 final var separator = Utils.getJavaVersion() >= 21 ? '\u202f' : ' '; 158 final var twelveAM = "12:00" + separator + "AM"; 159 assertEquals(twelveAM, DateUtils.formatTime(new Date(0), DateFormat.SHORT)); 160 assertEquals("1:00" + separator + "AM", DateUtils.formatTime(new Date(60 * 60 * 1000), DateFormat.SHORT)); 161 assertEquals(twelveAM, DateUtils.formatTime(new Date(999), DateFormat.SHORT)); 158 162 // ignore seconds 159 assertEquals( "12:00 AM", DateUtils.formatTime(new Date(5999), DateFormat.SHORT));163 assertEquals(twelveAM, DateUtils.formatTime(new Date(5999), DateFormat.SHORT)); 160 164 161 165 setTimeZone(TimeZone.getTimeZone("Europe/Berlin")); 162 assertEquals("1:00:00 166 assertEquals("1:00:00" + separator + "AM GMT+01:00", DateUtils.formatTime(new Date(0), DateFormat.LONG), "This is mostly dependent upon java.locale.providers. CET is also OK."); 163 167 } 164 168
Note:
See TracChangeset
for help on using the changeset viewer.