Currently date based constraint validators for @Past and @Future use the default system time to create the instant to compare with. This causes problems during testing, where there always will be border cases based on when the test is run. For testing purposes we want to be able to provide for example a constant instant via the TimeProvider contract. This way the test harness could be easily setup. Per default the TimeProvider would of course use the system time.
We can also consider to make the contract available for users, so that they can plug in their custom implementation. To a certain degree this is what for example java.lang.Clock tries to solve as well.
|