Class InvocationNotifierHandler<T>
java.lang.Object
org.mockito.internal.handler.InvocationNotifierHandler<T>
- All Implemented Interfaces:
Serializable, MockHandler<T>
Handler, that call all listeners wanted for this mock, before delegating it
to the parameterized handler.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<InvocationListener> private final MockHandler<T> -
Constructor Summary
ConstructorsConstructorDescriptionInvocationNotifierHandler(MockHandler<T> mockHandler, MockCreationSettings<T> settings) -
Method Summary
Modifier and TypeMethodDescriptionReturns the object that holds all invocations on the mock object, including stubbings with declared answers.Read-only settings the mock object was created with.handle(Invocation invocation) Takes an invocation object and handles it.private voidnotifyMethodCall(Invocation invocation, Object returnValue) private voidnotifyMethodCallException(Invocation invocation, Throwable exception)
-
Field Details
-
invocationListeners
-
mockHandler
-
-
Constructor Details
-
InvocationNotifierHandler
-
-
Method Details
-
handle
Description copied from interface:MockHandlerTakes an invocation object and handles it.The default implementation provided by Mockito handles invocations by recording method calls on mocks for further verification, captures the stubbing information when mock is stubbed, returns the stubbed values for invocations that have been stubbed, and much more.
- Specified by:
handlein interfaceMockHandler<T>- Parameters:
invocation- The invocation to handle- Returns:
- Result
- Throws:
Throwable- Throwable
-
notifyMethodCall
-
notifyMethodCallException
-
getMockSettings
Description copied from interface:MockHandlerRead-only settings the mock object was created with. SeeMockito.mock(Class, MockSettings)- Specified by:
getMockSettingsin interfaceMockHandler<T>- Returns:
- read-only settings of the mock
-
getInvocationContainer
Description copied from interface:MockHandlerReturns the object that holds all invocations on the mock object, including stubbings with declared answers. Do not provide your own implementation. Returned object is an internal implementation, hidden beneath a public marker interface.Please do not provide your own implementation of
InvocationContainerinterface at this point. If you have a use case that requires your own implementation ofInvocationContainerplease reach out to us. You can open a ticket in our issue tracker to start a discussion.- Specified by:
getInvocationContainerin interfaceMockHandler<T>- Returns:
- container of invocations, stubbings, and answers of the mock. The container is not part of the public API, please do not cast it or provide custom implementations.
-