You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Mockito 3 - has mockStatic but cannot mock System
Powermockito - depends on Mockito2 so isn't compatible with the mockito3 used natively here
EasyMock - dead
AspectJ - perhaps an option though may require some work for users of the library
JMockit - requires the app to be run with an agent flag
Instrument - java provides instrumentation options, but none of them fit here
Mocking Instant.now might be possible and Mockito3 could achieve that, though directing most of Instant's calls back to the proper implementation may be a minor challenge.
My original idea for this was to provide a ClockStub - see 2c91fa6 - 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:
fixed time
fixed but with an auto increment by a given tick every time the clock is read
While active I'd expect to be able to tell the ClockStub to change the time it returns.
No description provided.
The text was updated successfully, but these errors were encountered: