Closed Jean-Dv closed 11 months ago
Hi !
Thanks for the PR, but your fix is not enough, because it creates a new methods which is never used anywhere but in tests.
To mitigate this issue, I have 3 solutions in mind:
The simplest fix is to add
TimeZone.setDefault(TimeZone.getTimeZone(ZoneId.of("Europe/Paris")));
on GameBaseGame#setUp()
, and let the code unchanged. With this, the default system locale will be set to Europe/Paris.
Change the prototype of Information#lastLogin()
to takes a LocalDateTime
instead of Instant
as first parameter.
So, it will be the responsability of the caller to define the current timezone.
And on the unity test, you simply have to create the date on the Europe/Paris timezone.
This is the most complete solution.
First you need to implements the previous solution, and then define into GameConfiguration
the timezone to used for the current server instance.
Then inject the configuration on SelectCharacter
constructor, and use the configured timezone for creates the corresponding LocalDateTime.
Ok, thanks for the response. I will be adding the most complete solution and will resubmit the changes to this same PR.
Error
When I try to run the tests, I get the following error.
This error is generated because the Information.lastLogin method uses the system's default zoneId.
Fix
To correct, the methods are overwritten, in which a parameter is passed, which refers to the zoneId