Thanks for the tip Sam!

In git master, I just pushed using JUnit Pioneer instead of direct global
variables access for locales and timezones.

TY all for helping.

Gary


On Thu, Dec 26, 2024 at 9:16 AM tsz sum Ng <tszsumn...@gmail.com> wrote:

> Hi,
> Looks like the default timezone will affect the test.
> I can reproduce the error by adding
>
> TimeZone.setDefault(TimeZone.getTimeZone("GMT-5"));
>
> in the beginning of the test.
> It is because the date is formatted according to the default timezone,
> hence cal20051231
> of 2005-12-31 01:15 in GMT become 2005-12-30 20:15 in GMT-5,
>
> The fix could be setting the default timezone, like the default locale in
> the beginning of the test..
> TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
>
> Regards,
> Sam Ng
> On Thu, 26 Dec 2024 at 02:53, Gary Gregory <garydgreg...@gmail.com> wrote:
>
> > Hi All,
> >
> > With the HEAD of git master (commit
> > 2c1898f65ed46aa5c0f340f63b5e1f4a8b86e4f0), I get:
> >
> > [WARNING] Tests run: 25, Failures: 0, Errors: 0, Skipped: 1, Time
> elapsed:
> > 0.007 s -- in org.apache.commons.validator.routines.EmailValidatorTest
> > [INFO] Running
> org.apache.commons.validator.routines.CalendarValidatorTest
> > [ERROR] Tests run: 10, Failures: 1, Errors: 0, Skipped: 0, Time elapsed:
> > 0.009 s <<< FAILURE! -- in
> > org.apache.commons.validator.routines.CalendarValidatorTest
> > [ERROR]
> > org.apache.commons.validator.routines.CalendarValidatorTest.testFormat --
> > Time elapsed: 0.003 s <<< FAILURE!
> > org.opentest4j.AssertionFailedError: default ==> expected: <30/12/2005>
> but
> > was: <31/12/2005>
> > at
> >
> >
> org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
> > at
> >
> >
> org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
> > at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
> > at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
> > at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1156)
> > at
> >
> >
> org.apache.commons.validator.routines.CalendarValidatorTest.testFormat(CalendarValidatorTest.java:287)
> > at java.base/java.lang.reflect.Method.invoke(Method.java:569)
> > at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
> > at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
> >
> > But GitHub is OK.
> >
> > Does anyone else see this?
> >
> > This happens on Java 8, 11, 17, 21, and 23. For example:
> >
> > openjdk version "17.0.13" 2024-10-15
> > OpenJDK Runtime Environment Homebrew (build 17.0.13+0)
> > OpenJDK 64-Bit Server VM Homebrew (build 17.0.13+0, mixed mode, sharing)
> >
> > Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
> > Maven home: /opt/homebrew/Cellar/maven/3.9.9/libexec
> > Java version: 17.0.13, vendor: Homebrew, runtime:
> > /opt/homebrew/Cellar/openjdk@17
> /17.0.13/libexec/openjdk.jdk/Contents/Home
> > Default locale: en_US, platform encoding: UTF-8
> > OS name: "mac os x", version: "15.2", arch: "aarch64", family: "mac"
> >
> > Darwin ***.local 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec  6 19:03:40
> > PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6041 arm64
> > Docker version 27.3.1, build ce12230
> >
> > So it could be my Locale / TimeZone.
> >
> > Default locale: en_US
> > TZ: GMT-5 (US EST)
> >
> > Any thoughts?
> > TY,
> > Gary
> >
>
>
> --
> Ng Tsz Sum, Sam
> Mobile: 69276062
>

Reply via email to