Class TimeProvider.TimeTraveller
java.lang.Object
org.frankframework.util.TimeProvider.TimeTraveller
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
TimeProvider
TimeTraveller instances provide scoped access to modifying the "current time" in code. Closing the TimeTraveller instance will reset the clock to actual system time.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closing the TimeTraveller resets the clock to the system default clock, this ends the scope of the time-travel.getClock()Get theClockcurrently being used.voidONLY FOR UNIT TESTING!voidONLY FOR UNIT TESTING!voidsetTime(long millis) ONLY FOR UNIT TESTING!voidsetTime(LocalDateTime localDateTime) ONLY FOR UNIT TESTING!voidsetTime(ZonedDateTime zonedDateTime) ONLY FOR UNIT TESTING!
-
Method Details
-
close
public void close()Closing the TimeTraveller resets the clock to the system default clock, this ends the scope of the time-travel.- Specified by:
closein interfaceAutoCloseable
-
setClock
-
getClock
-
setTime
public void setTime(long millis) ONLY FOR UNIT TESTING! Set the clock to a fixed date-time from the milliseconds since 1-1-1970 passed in.- Parameters:
millis- Time in epoch-milliseconds to which to set the clock.
-
setTime
ONLY FOR UNIT TESTING! Set the clock to a fixed date-time from the local date-time passed in.- Parameters:
localDateTime- Time to which to set the clock.
-
setTime
ONLY FOR UNIT TESTING! Set the clock to a fixed date-time from the date-time invalid input: '&' timezone passed in.- Parameters:
zonedDateTime- The time to which to set the clock.
-
resetClock
public void resetClock()ONLY FOR UNIT TESTING! Resets the clock to the default System UTC clock. This should be used in the test-teardown method of unit tests when the unit tests have set the clock to a none-default clock.
-