I have a following line using Mockito:
when(mock.method()).thenReturn(foo).thenReturn(bar).thenThrow(new Exception("test"));
Is the above statement same as:
when(mock.method()).thenReturn(foo)thenThrow(new Exception("test"));
when(mock.method()).thenReturn(bar).thenThrow(new Exception("test"));
Please can anyone explain me, how would thenReturn
be executed?
How does it work?