This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
The following commit(s) were added to refs/heads/master by this push:
new 1ac4de078 Add but disable
FastDateParser_TimeZoneStrategyTest.testJava25DeprecatedZoneIds(Entry<String,
String>)
1ac4de078 is described below
commit 1ac4de078eb54c20c323d7a8ea439d15429cd293
Author: Gary Gregory <[email protected]>
AuthorDate: Mon Nov 3 07:20:43 2025 -0500
Add but disable
FastDateParser_TimeZoneStrategyTest.testJava25DeprecatedZoneIds(Entry<String,
String>)
---
.../time/FastDateParser_TimeZoneStrategyTest.java | 27 +++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git
a/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
b/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
index 3d2a975d4..8a4a137ac 100644
---
a/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
+++
b/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
@@ -31,7 +31,10 @@
import java.util.Date;
import java.util.List;
import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
import java.util.Objects;
+import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.atomic.AtomicInteger;
@@ -41,6 +44,7 @@
import org.apache.commons.lang3.LocaleUtils;
import org.apache.commons.lang3.SystemUtils;
import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
@@ -73,6 +77,10 @@ public static void afterAll() {
}
}
+ static Set<Entry<String, String>> getZoneIdStream() {
+ return ZoneId.SHORT_IDS.entrySet();
+ }
+
private String[][] getZoneStringsSorted(final Locale locale) {
return
ArraySorter.sort(DateFormatSymbols.getInstance(locale).getZoneStrings(),
Comparator.comparing(array -> array[0]));
}
@@ -81,7 +89,7 @@ private String[][] getZoneStringsSorted(final Locale locale) {
* Tests that known short {@link ZoneId}s still parse since all short IDs
are deprecated starting in Java 25, but are not removed.
*
* TODO: Why don't all short IDs parse, even on Java 8?
- *
+ *
* @throws ParseException Thrown on test failure.
*/
@ParameterizedTest
@@ -95,6 +103,23 @@ void testJava25DeprecatedZoneId(final String shortId)
throws ParseException {
assertEquals(2014, date1.getYear() + 1900);
}
+ /**
+ * Tests that {@link ZoneId#SHORT_IDS} keys and values still works as they
are deprecated starting in Java 25, but not removed yet.
+ *
+ * TODO: Why don't all short IDs parse, even on Java 8?
+ *
+ * @throws ParseException Thrown on test failure.
+ */
+ @Disabled
+ @ParameterizedTest
+ @MethodSource("getZoneIdStream")
+ void testJava25DeprecatedZoneIds(final Map.Entry<String, String> entry)
throws ParseException {
+ final FastDateParser parser = new FastDateParser("dd.MM.yyyy HH:mm:ss
z", TimeZone.getDefault(), Locale.GERMAN);
+ final Date date1 = parser.parse("26.10.2014 02:00:00 " +
entry.getKey());
+ final Date date2 = parser.parse("26.10.2014 02:00:00 " +
entry.getValue());
+ assertNotEquals(date1.getTime(), date2.getTime());
+ }
+
@Test
void testLang1219() throws ParseException {
final FastDateParser parser = new FastDateParser("dd.MM.yyyy HH:mm:ss
z", TimeZone.getDefault(), Locale.GERMAN);