Class TestClock
java.lang.Object
java.time.Clock
io.axoniq.framework.workflow.runtime.test.utils.TestClock
- All Implemented Interfaces:
InstantSource
Mutable clock for fixture-controlled workflow time.
- Since:
- 5.4.0
- Author:
- Simon Zambrovski
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.time.Clock
equals, fixed, hashCode, millis, offset, system, systemDefaultZone, systemUTC, tick, tickMillis, tickMinutes, tickSeconds
-
Constructor Details
-
TestClock
public TestClock()Creates a mutable clock. -
TestClock
Creates a mutable clock.- Parameters:
instant- initial instantzone- time zone
-
-
Method Details
-
getZone
Returns the time zone used by this clock. -
withZone
Creates a mutable clock with the same instant and a different time zone.- Specified by:
withZonein interfaceInstantSource- Specified by:
withZonein classClock- Parameters:
zone- time zone for the returned clock- Returns:
- mutable clock using the requested zone
-
instant
Returns the current fixture-controlled instant.- Specified by:
instantin interfaceInstantSource- Specified by:
instantin classClock- Returns:
- current instant
-
advanceBy
Advance the clock.- Parameters:
duration- duration to advance- Returns:
- new instant
-