title: Return different values each time from jMockit expectation
body: <p>I have a unit test where I am mocking <code>java.net.URI</code> class. Further, I am creating a jMockit <code>NonStrictExpectation</code> where I am expecting invocation of <code>URI.getPath()</code> and returning a particular string.</p>
  
  <p>The code being tested invokes <code>URI.getPath()</code> twice, where I need to send a different string each time.</p>
  
  <p>Here is my actual method under test:</p>
  
  <pre><code>public void validateResource() {
      // some code
      URI uri = new URI(link1.getHref());
      String path1 = uri.getPath();
      // some more code
      uri = new URI(link2.getHref());
      String path2 = uri.getPath();
  }
  </code></pre>
  
  <p>Here is the unit test code:</p>
  
  <pre><code>@Mocked URI uri;
  
  @Test
  public void testValidateResource() {
      new NonStrictExpectations() {
          {
              // for the first invocation
              uri.getPath(); returns("/resourceGroup/1");
  
              // for the second invocation [was hoping this would work]
              uri.getPath(); returns("/resource/2");
          }
      };
      myObject.validateResource();
  }
  </code></pre>
  
  <p>Now, I want <code>"/resource/2"</code> to be returned from my expectation when the <code>URI.getPath()</code> is called second time. But it always hits the first expectation and returns <code>"/recourceGroup/1"</code>. This is my problem.</p>
  
  <p>How do I make it happen? I can't really use <code>StrictExpectations</code> due to a number of reasons, and will have to stick with <code>NonStrictExpectations</code>.</p>