I am having a problem with mockito. I am developing a web application. In my tests, the user manual is being mocked. There are some cases where I have to change the user returned by the getLoggedInUser() method.
The problem is that my getLoggedInUser() method can also raise an AuthenticationException .
Therefore, when I try to switch from one user to another user, the call
when(userProvider.getLoggedInUser()).thenReturn(user);
throws an exception because userProvider.getLoggedInUser() already wrapped with thenTrow()
Is there a way to tell the when method not to care about exceptions?
Thanks in advance - IstvΓ‘n
java mockito mocking stubbing
Szobi
source share