Class DummyNanoClock

  • All Implemented Interfaces:
    NanoClock

    public final class DummyNanoClock
    extends java.lang.Object
    implements NanoClock
    Implementation of the NanoClock interface that always returns a fixed value.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private long fixedNanoTime  
    • Constructor Summary

      Constructors 
      Constructor Description
      DummyNanoClock()  
      DummyNanoClock​(long fixedNanoTime)
      Constructs a new DummyNanoClock with the specified value to return.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long nanoTime()
      Returns the constructor value.
      • Methods inherited from class java.lang.Object

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

      • fixedNanoTime

        private final long fixedNanoTime
    • Constructor Detail

      • DummyNanoClock

        public DummyNanoClock()
      • DummyNanoClock

        public DummyNanoClock​(long fixedNanoTime)
        Constructs a new DummyNanoClock with the specified value to return.
        Parameters:
        fixedNanoTime - the value to return from nanoTime().
    • Method Detail

      • nanoTime

        public long nanoTime()
        Returns the constructor value.
        Specified by:
        nanoTime in interface NanoClock
        Returns:
        the constructor value