Quarkus Clock
Provides an injectable java.time.Clock for Quarkus applications.
Use the system clock in production, a fixed instant for deterministic tests, or an adjustable clock when you need to move time forward in tests and development.
Supported clock types:
-
system(default) —Clock.systemUTC() -
fixed— a constant ISO-8601 instant -
adjustable— anAdjustableClockyou can advance or travel
Installation
Add the io.quarkiverse.clock:quarkus-clock extension to your build file.
With Maven, add the following to your pom.xml:
<dependency>
<groupId>io.quarkiverse.clock</groupId>
<artifactId>quarkus-clock</artifactId>
<version>0.1.0</version>
</dependency>
With Gradle, add the following to your build.gradle:
implementation("io.quarkiverse.clock:quarkus-clock:0.1.0")
Next steps
-
Using the extension — inject
Clockand choose a clock type -
Testing — fixed and adjustable clocks in tests