Mockito 3 Stubber

Mockito provides Stubber interface, which defines doThrow | doAnswer | doNothing | doReturn methods. its adviced to use Stubber interface methods while dealing with partial mock and void methods.

Method defined in Mockito class. ie Mockito#doThrow(Throwable[]) | Mockito#doAnswer(Answer) | Mockito#doNothing() | Mockito#doReturn(Object) internally uses Stubber interface.

 

follow us on