Xray-App / xray-junit-extensions

Enhanced JUnit 5 integration with Xray Test Management for Jira
Eclipse Public License 2.0
16 stars 8 forks source link

Broken test due to timezone #15

Closed vduhautois closed 2 years ago

vduhautois commented 2 years ago

this test is broken when I run it locally : testsShouldHaveStartAndFinishTimestamps

We have this code:

String fakeTimestamp = "2021-03-24T12:01:02.456";
LocalDateTime now = LocalDateTime.parse(fakeTimestamp);
ZoneId zone = ZoneId.systemDefault();
Clock clock = Clock.fixed(ZonedDateTime.of(now, zone).toInstant(), zone);

When I run it, I have this failure: Expected :"2021-03-24T12:01:02.456" Actual :"2021-03-24T11:01:02.456"

I would have change the ZoneId to:

ZoneId.of("UTC");

As there is no timezone involved when working in UTC, there is no chance of failure because of it.

bitcoder commented 2 years ago

Thanks for reporting and for the suggestion, will have a look at it ASAP