Bug Tests on kolmafia using Calendar are implemented incorrectly

Irrat

Member
The following tests use Calendar and consistently fails when I run them.

canDetectHoliday() obtainOysterEggOnWrongDay() obtainOysterEggOnWrongDayAndWithoutBasket()

The reason for this is that the timezones of the test runner are not taken into account.

https://github.com/kolmafia/kolmafi...kolmafia/session/ResultProcessorTest.java#L76
https://github.com/kolmafia/kolmafia/blob/main/test/internal/helpers/Player.java#L856

I'm using New Zealand time, which basically fails these tests. I'm not sure how to go about fixing this in regards to implementation.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
I wrote these tests and remember wondering if they'd break in Australia. They were too important not to have at the time though. I'll have to put some thought into them
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Probably setting TimeZone.setDefault(TimeZone.getTimeZone("UTC")); before will work
 

Irrat

Member
Probably setting TimeZone.setDefault(TimeZone.getTimeZone("UTC")); before will work
Eh. Looking at the implementation of the cleanup method, I'm not too sure on that. It specifically overrides methods that returns other timezones
 
Top