Interface BusinessTime


@Service
public interface BusinessTime
Component to allow access to the current business time. It will usually return the current system time but allows manually forwarding it by a certain Duration for testing and simulation purposes.
Author:
Paul Henke, Oliver Gierke, Rico Bergmann
  • Method Details

    • getTime

      LocalDateTime getTime()
      Returns the current business time. This will be the time of the system the application is running on by default but can be adjusted by calling forward(Duration).
      Returns:
    • forward

      void forward​(Duration duration)
      Forwards the current time with the given Duration. Calling the method multiple times will accumulate durations.
      Parameters:
      duration -
    • getOffset

      Duration getOffset()
      Returns the current offset between the real time and the virtual one created by calling forward(Duration).
      Returns:
    • reset

      void reset()
      Undoes any forwarding. Afterwards any call to getTime() will be equivalent to the system's time again.