Class MockSleeper

  • All Implemented Interfaces:
    Sleeper

    @Beta
    public class MockSleeper
    extends java.lang.Object
    implements Sleeper
    Beta
    Mock for Sleeper.

    Implementation is not thread-safe.

    Since:
    1.15
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int count
      Number of times sleep(long) was called.
      private long lastMillis
      Value of millis parameter when sleep(long) was last called or 0 if not called.
      • Fields inherited from interface com.google.api.client.util.Sleeper

        DEFAULT
    • Constructor Summary

      Constructors 
      Constructor Description
      MockSleeper()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getCount()
      Returns the number of times sleep(long) was called.
      long getLastMillis()
      Returns the value of millis parameter when sleep(long) was last called or 0 if not called.
      void sleep​(long millis)
      Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds as specified in Thread.sleep(long).
      • Methods inherited from class java.lang.Object

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

      • count

        private int count
        Number of times sleep(long) was called.
      • lastMillis

        private long lastMillis
        Value of millis parameter when sleep(long) was last called or 0 if not called.
    • Constructor Detail

      • MockSleeper

        public MockSleeper()
    • Method Detail

      • sleep

        public void sleep​(long millis)
                   throws java.lang.InterruptedException
        Description copied from interface: Sleeper
        Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds as specified in Thread.sleep(long).
        Specified by:
        sleep in interface Sleeper
        Parameters:
        millis - length of time to sleep in milliseconds
        Throws:
        java.lang.InterruptedException - if any thread has interrupted the current thread
      • getCount

        public final int getCount()
        Returns the number of times sleep(long) was called.
      • getLastMillis

        public final long getLastMillis()
        Returns the value of millis parameter when sleep(long) was last called or 0 if not called.