when(...) thenReturn(...) makes a real method call just before it is mocked. So if the called method throws an Exception you have to deal with it / mock it etc. Of course you still get your result (what you define in thenReturn(...) )
doReturn(...) when(...) does not call the method at all.
Subscribe to:
Post Comments (Atom)
|
|
No comments:
Post a Comment