clock of the
configuration. By default it is the system clock in the default time zone.
Trial.kt
The rules that read the clock
The rules that compare two values, such as
after(other) or weekday(), do not read the clock.
now, in your own rules
now(of) reads the current time from the clock of the validation in progress, so a custom rule follows a fixed clock
the same way the built-in ones do:
of is any function that takes a Clock, such as LocalDate::now, Instant::now or ZonedDateTime::now.
Fixing the clock
- In tests
- For the application
- For one user
Pass a
Validity with a fixed clock to the call under test. The default configuration does not change, so tests
that run in parallel do not see each other’s clocks:A zoned or offset date and time is moved to the zone of the clock before
today compares its date.