Class MockSleeper

java.lang.Object
com.google.api.client.testing.util.MockSleeper
All Implemented Interfaces:
Sleeper

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

Implementation is not thread-safe.

Since:
1.15
  • Field Details

    • 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 Details

    • MockSleeper

      public MockSleeper()
  • Method Details

    • sleep

      public void sleep(long millis) throws 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:
      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.