You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/08/11 21:21:46 UTC

[commons-lang] 02/02: Try to fix HG build

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

commit 971efec0e17c7238ff397a7b149ac316ca156b76
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Aug 11 17:21:23 2023 -0400

    Try to fix HG build
---
 .../lang3/time/FastDateParser_TimeZoneStrategyTest.java | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

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 f189718fb..b4fe15b32 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
@@ -53,8 +53,8 @@ public class FastDateParser_TimeZoneStrategyTest extends AbstractLangTest {
 
     @ParameterizedTest
     @MethodSource("java.util.Locale#getAvailableLocales")
-    public void testTimeZoneStrategyPattern(final Locale locale) {
-        testTimeZoneStrategyPattern(locale, TimeZones.GMT);
+    public void testTimeZoneStrategy(final Locale locale) {
+        testTimeZoneStrategyPattern(locale);
     }
 
     /**
@@ -62,26 +62,25 @@ public class FastDateParser_TimeZoneStrategyTest extends AbstractLangTest {
      *
      * @throws ParseException
      */
-    private void testTimeZoneStrategyPattern(final Locale locale, final TimeZone tzDefault) {
+    private void testTimeZoneStrategyPattern(final Locale locale) {
         Objects.requireNonNull(locale, "locale");
-        Objects.requireNonNull(tzDefault, "tzDefault");
         assumeFalse(LocaleUtils.isLanguageUndetermined(locale), () -> toFailureMessage(locale, null));
         assumeTrue(LocaleUtils.isAvailableLocale(locale), () -> toFailureMessage(locale, null));
-        final FastDateParser parser = new FastDateParser("z", tzDefault, locale);
 
         for (final String id : TimeZone.getAvailableIDs()) {
             final TimeZone timeZone = TimeZone.getTimeZone(id);
+            final FastDateParser parser = new FastDateParser("z", timeZone, locale);
             final String displayName = timeZone.getDisplayName(locale);
             try {
                 parser.parse(displayName);
             } catch (ParseException e) {
                 // Missing "Zulu" or something else in broken JDK's GH builds?
-                fail(String.format("%s: with tzDefault = %s, locale = %s, id = %s, timeZone = %s, displayName = %s, parser = '%s'", e, tzDefault, locale,
-                        displayName, id, timeZone, displayName, parser.toStringAll()), e);
+                fail(String.format("%s: with locale = %s, id = '%s', timeZone = %s, displayName = '%s', parser = '%s'", e, locale, displayName, id, timeZone,
+                        displayName, parser.toStringAll()), e);
             }
         }
 
-// The above replaces what's below.
+// The above replaces what's below and fails on certain locale/time zones on GH.
 //
 // Calling getZoneStrings() is not recommended in the Javadoc but not deprecated.
 //
@@ -116,7 +115,7 @@ public class FastDateParser_TimeZoneStrategyTest extends AbstractLangTest {
         final TimeZone tzDefault = TimeZone.getTimeZone("Etc/UTC");
         final FastDateParser parser = new FastDateParser("z", tzDefault, locale);
         parser.parse(source);
-        testTimeZoneStrategyPattern(locale, tzDefault);
+        testTimeZoneStrategyPattern(locale);
     }
 
     private String toFailureMessage(final Locale locale, final String languageTag) {