Class TimeKeeper


  • public class TimeKeeper
    extends java.lang.Object
    Class used to wrap timekeeping functionality. By default uses normal methods, but can be overridden to provide additional functionality.
    • Constructor Summary

      Constructors 
      Constructor Description
      TimeKeeper()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getCurrentTimeMillis()
      Get the current time in milliseconds.
      void timeTravel​(long addTime)
      Throws a RuntimeException by default.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TimeKeeper

        public TimeKeeper()
    • Method Detail

      • getCurrentTimeMillis

        public long getCurrentTimeMillis()
        Get the current time in milliseconds.
        Returns:
        The current time in milliseconds.
      • timeTravel

        public void timeTravel​(long addTime)
        Throws a RuntimeException by default. Should never be used by non testing code. Allows a test to simulate the passage of time, in a manner appropriate to the test.
        Parameters:
        addTime - The amount of time to travel by.