title: Mock same method with different parameters
body: <p>I am using mockito to test my business service, and it uses a utility that i want to mock. there are at least 2-3 calls in each service method for utility with different arguments. </p>
  
  <p>Is there any recommended way to use multiple <code>when(...).thenReturn(...)</code> for same method but different arguments?</p>
  
  <p>I also want to use <code>any()</code> marcher as well inside. Is it possible?</p>
  
  <p>Update: sample code.</p>
  
  <pre><code>@Test
  public void myTest() {
    when(service.foo(any(), new ARequest(1, "A"))).thenReturn(new AResponse(1, "passed"));
    when(service.foo(any(), new ARequest(2, "2A"))).thenReturn(new AResponse(2, "passed"));
    when(service.foo(any(), new BRequest(1, "B"))).thenReturn(new BResponse(112, "passed"));
  
    c.execute();
  }
  
  public class ClassUnderTest {
    Service service = new Service();
    public void execute() {
      AResponse ar = (AResponse) service.foo("A1", new ARequest(1, "A"));
      AResponse ar2 = (AResponse) service.foo("A2", new ARequest(2, "2A"));
      BResponse br = (BResponse) service.foo("B1", new BRequest(1, "B"));
    }
  }
  
  public class Service {
    public Object foo(String firstArgument, Object obj) {
      return null; //return something
    }
  }
  </code></pre>