title: How to mock Thread.sleep() with PowerMock?
body: <p>How to mock Thread.sleep() with PowerMock?</p>
  
  <p>Sample interface and class:</p>
  
  <pre><code>public interface Machine {
  
      void sleep(long millis);
  }
  
  public class MachineImpl
  implements Machine {
  
      private static final Logger logger = Logger.getLogger(MachineImpl.class);
  
      @Override
      public void sleep(long millis) {
          try {
              if (millis &gt; 0) {
                  logger.trace(String.format("Try to sleep for %d millis...", millis));
                  Thread.sleep(millis);
              }
          }
          catch (InterruptedException e) {
              logger.trace("Full exception", e);
          }
      }
  }
  </code></pre>