Difference between Mockito’s when/thenReturn and doReturn/when
A common dilemma while writing unit tests in Java is whether to use Mockito’s when/thenReturn or doReturn/when stubbings. Both when/thenReturn and doReturn/when are used in Mockito, a popular Java testing framework, to mock behavior of methods in an object. However, they are used in slightly different scenarios. when/thenReturn is used to mock the return value… read more »