title: Mockito: method's return value depends on other method called
body: <p>In my unit test I need to mock an interface which among different methods has <code>nextItem()</code> and <code>isEmpty()</code> methods:</p>
  
  <pre><code>public interface MyQueue {
      Item nextItem();
      boolean isEmpty();
      //other methods
      ...
  }
  </code></pre>
  
  <p>My requirement for the mock is that <code>isEmpty()</code> initially should return false, but after <code>nextItem()</code> was called <code>isEmpty()</code> should return true. Thus I'm mocking a queue with one item.</p>
  
  <ol>
  <li>What is the simplest way to implement this kind of mock with mockito?</li>
  <li>Can I implement additional requirement: calling <code>nextItem()</code> second, third time and so on will result in a specific kind of exception?</li>
  </ol>
  
  <p>P.S. I don't want to provide the full implementation of my interface for the test, because of other methods in it, resulting in hard-to-understand and verbose code.</p>