Ban Management

Ban Management

193k Downloads

DateUtilsTest#shouldFormatTimestamp() failure

voidpointer0x00 opened this issue ยท 0 comments

commented

Issue report

  • BanManager Version: 7.1.0-SNAPSHOT commit 7cfd2de master

Describe your issue:
Test failure:
Failed tests: shouldFormatTimestamp(me.confuser.banmanager.common.util.DateUtilsTest): expected:<04-03-2020 1[1]:27:47> but was:<04-03-2020 1[6]:27:47>

How to replicate:
I guess that happens because of different timezones. I have +5 GMT (16-11 = 5 ๐Ÿ˜„), so failure looks like that's timezone issue.
Maybe change hard coded time to timezone-dependent will solve problem, but I'm actually not sure how to change it in a clear way.

assertEquals("04-03-2020 11:27:47", DateUtils.format("dd-MM-yyyy HH:mm:ss", timestamp));
assertEquals("2020-03-04 11:27:47 +0000", DateUtils.format("yyyy-MM-dd HH:mm:ss Z", timestamp));
assertEquals("2020-03-04_11-27-47", DateUtils.format("yyyy-MM-dd_HH-mm-ss", timestamp));