Open ashleyfrieze opened 3 years ago
My original idea for this was to provide a ClockStub
- see https://github.com/webcompere/system-stubs/commit/2c91fa6156763f74ade7e60f87a2f2f309f5db44 - this would replace time as globally as possible (I'd rather hook into System.currentTimeMillis
to get every possible time call). I had the idea of two modes:
While active I'd expect to be able to tell the ClockStub
to change the time it returns.
This is a lot more challenging than it first appears. Part of the challenge is avoiding the user of the library having to do a lot of things or depend on too specific versions of libraries.
mockStatic
but cannot mockSystem
Mocking
Instant.now
might be possible andMockito3
could achieve that, though directing most ofInstant
's calls back to the proper implementation may be a minor challenge.