Class TestMockTime

  • All Implemented Interfaces:
    Time, io.tehuti.utils.Time

    public class TestMockTime
    extends java.lang.Object
    implements Time, io.tehuti.utils.Time
    A Time implementation which abstracts logical time away from real time, so that it can be deterministically controlled. Useful for tests which are timing-dependent.
    • Constructor Detail

      • TestMockTime

        public TestMockTime()
      • TestMockTime

        public TestMockTime​(long time)
    • Method Detail

      • getMilliseconds

        public long getMilliseconds()
        Specified by:
        getMilliseconds in interface Time
      • getNanoseconds

        public long getNanoseconds()
        Specified by:
        getNanoseconds in interface Time
      • sleep

        public void sleep​(long ms)
        Specified by:
        sleep in interface Time
        Specified by:
        sleep in interface io.tehuti.utils.Time
      • setTime

        public void setTime​(long ms)
      • addMilliseconds

        public void addMilliseconds​(long ms)
      • milliseconds

        public long milliseconds()
        For interop with Tehuti's Time abstraction
        Specified by:
        milliseconds in interface io.tehuti.utils.Time
      • nanoseconds

        public long nanoseconds()
        For interop with Tehuti's Time abstraction
        Specified by:
        nanoseconds in interface io.tehuti.utils.Time