Skip to content

TestPureDate.java fails on Java 11.0.9 #55

@ghost

Description

Bug Report

In Java 11.0.9 the use of timezone "CST" no longer works causing the test on line 55 of TestPureDate.java to fail:

Assert.assertEquals("2013-12-31 19:01:01.070 CST", date.format("[CST]yyyy-MM-dd HH:mm:ss.SSS z"));

Tests run: 13, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.388 sec <<< FAILURE! - in org.finos.legend.pure.m4.coreinstance.primitive.date.TestPureDate
testFormatWithTimeZoneShift(org.finos.legend.pure.m4.coreinstance.primitive.date.TestPureDate)  Time elapsed: 0.029 sec  <<< FAILURE!

This should instead be

Assert.assertEquals("2013-12-31 19:01:01.070 GMT-06:00", date.format("[CST]yyyy-MM-dd HH:mm:ss.SSS z"));

Steps to Reproduce:

  1. Using Java 11.0.9
  2. run mvn -Dtest=TestPureDate test
  3. The test on line 55 fails
  4. Using Java 11.0.7
  5. run mvn -Dtest=TestPureDate test
  6. The test on line 55 passes

Expected Result:

The test should pass consistently on 11.0.7 and 11.0.9

Actual Result:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.finos.legend.pure.m4.coreinstance.primitive.date.TestPureDate
Tests run: 13, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.388 sec <<< FAILURE! - in org.finos.legend.pure.m4.coreinstance.primitive.date.TestPureDate
testFormatWithTimeZoneShift(org.finos.legend.pure.m4.coreinstance.primitive.date.TestPureDate)  Time elapsed: 0.029 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<...-12-31 19:01:01.070 [CST]> but was:<...-12-31 19:01:01.070 [GMT-06:00]>
        at org.junit.Assert.assertEquals(Assert.java:117)
        at org.junit.Assert.assertEquals(Assert.java:146)
        at org.finos.legend.pure.m4.coreinstance.primitive.date.TestPureDate.testFormatWithTimeZoneShift(TestPureDate.java:55)

Results :

Failed tests:
  TestPureDate.testFormatWithTimeZoneShift:55 expected:<...-12-31 19:01:01.070 [CST]> but was:<...-12-31 19:01:01.070 [GMT-06:00]>

Environment:

Version: master after commit f98651e
OS: Ubuntu 18.04.5 LTS and Windows 10 (baremetal)
Java: 11.0.7 and 11.0.9

Additional Context:

As this issue is version specific I believe it needs a deeper dive into the use of java.util.TimeZone across the project. In this case used on line 255 of DateFormat.java

I am happy to open a PR to resolve across the board; let me know if you would like me to proceed

Ref: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/TimeZone.html

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