Package org.mockito.listeners
Interface StubbingLookupListener
-
public interface StubbingLookupListener
When a method is called on a mock object Mockito looks up any stubbings recorded on that mock. This listener gets notified on stubbing lookup. Register listener viaMockSettings.stubbingLookupListeners(StubbingLookupListener...)
. This API is used by Mockito to implementPotentialStubbingProblem
(part of MockitoStrictness
).Details: When method is called on the mock object, Mockito looks for any answer (stubbing) declared on that mock. If the stubbed answer is found, that answer is then invoked (value returned, thrown exception, etc.). If the answer is not found (e.g. that invocation was not stubbed on the mock), mock's default answer is used. This listener implementation is notified when Mockito attempts to find an answer for invocation on a mock.
The listeners can be accessed via
MockCreationSettings.getStubbingLookupListeners()
.- Since:
- 2.24.6
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
onStubbingLookup(StubbingLookupEvent stubbingLookupEvent)
Called by the framework when Mockito looked up an answer for invocation on a mock.
-
-
-
Method Detail
-
onStubbingLookup
void onStubbingLookup(StubbingLookupEvent stubbingLookupEvent)
Called by the framework when Mockito looked up an answer for invocation on a mock. For details, seeStubbingLookupListener
.- Parameters:
stubbingLookupEvent
- - Information about the looked up stubbing- Since:
- 2.24.6
-
-