title: Mockito mock a method with infinite loop
body: <p>I have a method as follows</p>
  
  <pre><code>public class ClientClass {
  
      public void clientMethod() {
          while(true){
             doSomethings.....
         }
      }
  }
  </code></pre>
  
  <p>I am trying to test using mockito. I am able to make the call to clientMethod, but since there is a while(true) inside clientMethod, the call never returns and I never reach to my assert statements which (of course) occur after clientMethod() invocation.
  Is there a way to stop the loop after one loop iteration from my test case?</p>