https://docs.oracle.com/javase/8/docs/api/java/time/Instant....
Code under test creates Instant, so long as it uses the Clock you've passed in, you'll control how it determines when now() is.
You've got several built-in testing clocks like this one[1], but can also implement your own.
[1]: https://docs.oracle.com/javase/8/docs/api/java/time/Clock.ht...
https://docs.oracle.com/javase/8/docs/api/java/time/Instant....
Code under test creates Instant, so long as it uses the Clock you've passed in, you'll control how it determines when now() is.
You've got several built-in testing clocks like this one[1], but can also implement your own.
[1]: https://docs.oracle.com/javase/8/docs/api/java/time/Clock.ht...