Skip to content

Fix: Environment-agnostic TimeZone formatting in TestPureDate #4531

@kapilhadoltikar

Description

@kapilhadoltikar

Bug Report

Steps to Reproduce:

  1. Clone the legend-engine repository.
  2. Navigate to the legend-engine-executionPlan-execution module.
  3. Execute the Maven test suite using the command: mvn clean test -Dtest=TestPureDate.
  4. Observe the test failure in the testFormatWithTimeZoneShift method.

Expected Result:

The test should pass
BUILD SUCCESS without any assertion errors, confirming that the date-time string is formatted correctly with the expected timezone abbreviation (e.g., CST).

Actual Result:

The test fails because the date-time string is formatted using a GMT offset instead of the short ID:

[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]   TestPureDate.testFormatWithTimeZoneShift:71 expected:<...-12-31 19:01:01.070 [CST]> but was:<...-12-31 19:01:01.070 [GMT-06:00]>
[INFO]
[ERROR] Tests run: 15, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] -----------------------------------------------------------------------
-

Environment:

  1. Project version/build: 4.122.1-SNAPSHOT
  2. OS and runtime versions: Windows 11, OpenJDK Temurin 11.0.30 , Maven 3.9.11
  3. Virtualised environment: None

Proposed Solution:

The failure is caused by the JDK's switch to the CLDR (Unicode Common Locale Data Repository) as the default locale provider, which sometimes formats the z pattern as a GMT offset instead of a short ID.

I propose updating the assertion in testFormatWithTimeZoneShift to accept both the short ID (e.g., CST) and the GMT offset (e.g., GMT-06:00). This ensures the test remains environment-agnostic while still validating the correct time-shift logic.

I intend to submit a Pull Request for this immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions