-
Notifications
You must be signed in to change notification settings - Fork 139
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:
legend-pure/legend-pure-m4/src/test/java/org/finos/legend/pure/m4/primitives/TestPureDate.java
Line 55 in f98651e
| 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:
- Using Java 11.0.9
- run
mvn -Dtest=TestPureDate test - The test on line 55 fails
- Using Java 11.0.7
- run
mvn -Dtest=TestPureDate test - 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
Line 255 in 66fbd19
| dateFormat.setTimeZone(calendar.getTimeZone()); |
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