Skip to content

Commit 1ac4de0

Browse files
committed
Add but disable
FastDateParser_TimeZoneStrategyTest.testJava25DeprecatedZoneIds(Entry<String, String>)
1 parent bfcaa94 commit 1ac4de0

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131
import java.util.Date;
3232
import java.util.List;
3333
import java.util.Locale;
34+
import java.util.Map;
35+
import java.util.Map.Entry;
3436
import java.util.Objects;
37+
import java.util.Set;
3538
import java.util.TimeZone;
3639
import java.util.concurrent.atomic.AtomicInteger;
3740

@@ -41,6 +44,7 @@
4144
import org.apache.commons.lang3.LocaleUtils;
4245
import org.apache.commons.lang3.SystemUtils;
4346
import org.junit.jupiter.api.AfterAll;
47+
import org.junit.jupiter.api.Disabled;
4448
import org.junit.jupiter.api.Test;
4549
import org.junit.jupiter.params.ParameterizedTest;
4650
import org.junit.jupiter.params.provider.MethodSource;
@@ -73,6 +77,10 @@ public static void afterAll() {
7377
}
7478
}
7579

80+
static Set<Entry<String, String>> getZoneIdStream() {
81+
return ZoneId.SHORT_IDS.entrySet();
82+
}
83+
7684
private String[][] getZoneStringsSorted(final Locale locale) {
7785
return ArraySorter.sort(DateFormatSymbols.getInstance(locale).getZoneStrings(), Comparator.comparing(array -> array[0]));
7886
}
@@ -81,7 +89,7 @@ private String[][] getZoneStringsSorted(final Locale locale) {
8189
* Tests that known short {@link ZoneId}s still parse since all short IDs are deprecated starting in Java 25, but are not removed.
8290
*
8391
* TODO: Why don't all short IDs parse, even on Java 8?
84-
*
92+
*
8593
* @throws ParseException Thrown on test failure.
8694
*/
8795
@ParameterizedTest
@@ -95,6 +103,23 @@ void testJava25DeprecatedZoneId(final String shortId) throws ParseException {
95103
assertEquals(2014, date1.getYear() + 1900);
96104
}
97105

106+
/**
107+
* Tests that {@link ZoneId#SHORT_IDS} keys and values still works as they are deprecated starting in Java 25, but not removed yet.
108+
*
109+
* TODO: Why don't all short IDs parse, even on Java 8?
110+
*
111+
* @throws ParseException Thrown on test failure.
112+
*/
113+
@Disabled
114+
@ParameterizedTest
115+
@MethodSource("getZoneIdStream")
116+
void testJava25DeprecatedZoneIds(final Map.Entry<String, String> entry) throws ParseException {
117+
final FastDateParser parser = new FastDateParser("dd.MM.yyyy HH:mm:ss z", TimeZone.getDefault(), Locale.GERMAN);
118+
final Date date1 = parser.parse("26.10.2014 02:00:00 " + entry.getKey());
119+
final Date date2 = parser.parse("26.10.2014 02:00:00 " + entry.getValue());
120+
assertNotEquals(date1.getTime(), date2.getTime());
121+
}
122+
98123
@Test
99124
void testLang1219() throws ParseException {
100125
final FastDateParser parser = new FastDateParser("dd.MM.yyyy HH:mm:ss z", TimeZone.getDefault(), Locale.GERMAN);

0 commit comments

Comments
 (0)