Uploaded image for project: 'Hibernate Validator'
  1. HV-897

Create a TimeProvider contract to get the current data time

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.2.0.CR1
    • Component/s: engine
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      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.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: