title: Mockito - difference between doReturn() and when()
body: <p>I am currently in the process of using Mockito to mock my service layer objects in a Spring MVC application in which I want to test my Controller methods. However, as I have been reading on the specifics of Mockito, I have found that the methods <code>doReturn(...).when(...)</code> is equivalent to <code>when(...).thenReturn(...)</code>. So, my question is what is the point of having two methods that do the same thing or what is the subtle difference between <code>doReturn(...).when(...)</code> and <code>when(...).thenReturn(...)</code>?</p>
  
  <p>Any help would be appreciated.</p>