[ https://issues.apache.org/jira/browse/LOG4J2-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15925378#comment-15925378 ]
shishir chaturvedi commented on LOG4J2-1849: -------------------------------------------- Hi Remko, I have added *testFormatLong_goingBackInTime_DST* test case in *org.apache.logging.log4j.core.util.datetime.FixedDateFormatTest* which is failing for obvious reasons. Are you referring to this test case. I would like to contribute test cases similar to this. Please share your feedback. {code} /** * This test case validated date pattern before and after DST * Base Date : 12 Mar 2017 * Daylight Savings started on : 02:00 AM */ @Test public void testFormatLong_goingBackInTime_DST() { final Calendar instance = Calendar.getInstance(); instance.set(2017, 2, 12, 2, 0); final long now = instance.getTimeInMillis(); final long start = now - TimeUnit.HOURS.toMillis(1); final long end = now + TimeUnit.HOURS.toMillis(1); for (final FixedFormat format : FixedFormat.values()) { final SimpleDateFormat simpleDF = new SimpleDateFormat(format.getPattern(), Locale.getDefault()); final FixedDateFormat customTF = new FixedDateFormat(format, TimeZone.getDefault()); for (long time = end; time > start; time -= 12345) { final String actual = customTF.format(time); final String expected = simpleDF.format(new Date(time)); assertEquals(format + "(" + format.getPattern() + ")" + "/" + time, expected, actual); } } } {code} h4. Output of this testcase, {color:red} org.junit.ComparisonFailure: ABSOLUTE(HH:mm:ss,SSS)/1489305654242 Expected :04:00:54,242 Actual :03:00:54,242 {color} > Broken FixedDateFormat tests when daylight saving time starts > ------------------------------------------------------------- > > Key: LOG4J2-1849 > URL: https://issues.apache.org/jira/browse/LOG4J2-1849 > Project: Log4j 2 > Issue Type: Bug > Components: Core > Affects Versions: 2.8.1 > Reporter: Matt Sicker > Assignee: Remko Popma > > Today we started daylight saving time in the US, and the following tests > failed: > {noformat} > Failed tests: > FixedDateFormatTest.testFormatLong:162 ABSOLUTE(HH:mm:ss,SSS)/1489305608119 > expected:<0[3]:00:08,119> but was:<0[2]:00:08,119> > FixedDateFormatTest.testFormatLongCharArrayInt:196 > ABSOLUTE(HH:mm:ss,SSS)/1489305607930 expected:<0[3]:00:07,930> but > was:<0[2]:00:07,930> > FixedDateFormatTest.testFormatLongCharArrayInt_goingBackInTime:214 > ABSOLUTE(HH:mm:ss,SSS)/1489381194091 expected:<2[3]:59:54,091> but > was:<2[2]:59:54,091> > FixedDateFormatTest.testFormatLong_goingBackInTime:178 > ABSOLUTE(HH:mm:ss,SSS)/1489381194072 expected:<2[3]:59:54,072> but > was:<2[2]:59:54,072> > {noformat} -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org