Package | Description |
---|---|
org.mockito |
Mockito is a mock library for java - see
Mockito class for usage. |
org.mockito.invocation |
Public API related to mock method invocations.
|
org.mockito.listeners |
Public classes relative to the listener APIs.
|
org.mockito.plugins |
Mockito plugins allow customization of behavior.
|
Modifier and Type | Method and Description |
---|---|
<T> MockCreationSettings<T> |
MockSettings.build(Class<T> typeToMock)
Creates immutable view of mock settings used later by Mockito.
|
MockCreationSettings<?> |
MockingDetails.getMockCreationSettings()
Returns various mock settings provided when the mock was created, for example:
mocked class, mock name (if any), any extra interfaces (if any), etc.
|
Modifier and Type | Method and Description |
---|---|
MockCreationSettings<T> |
MockHandler.getMockSettings()
Read-only settings the mock object was created with.
|
Modifier and Type | Method and Description |
---|---|
Invocation |
InvocationFactory.createInvocation(Object target,
MockCreationSettings settings,
Method method,
Callable realMethod,
Object... args)
Deprecated.
Use
InvocationFactory.createInvocation(Object, MockCreationSettings, Method, RealMethodBehavior, Object...) instead.
Why deprecated? We found use cases where we need to handle Throwable and ensure correct stack trace filtering
(removing Mockito internals from the stack trace). Hence the introduction of InvocationFactory.RealMethodBehavior .
Creates instance of an Invocation object.
This method is useful for framework integrators to programmatically simulate method calls on mocks using MockHandler .
It enables advanced framework integrations. |
Invocation |
InvocationFactory.createInvocation(Object target,
MockCreationSettings settings,
Method method,
InvocationFactory.RealMethodBehavior realMethod,
Object... args)
Creates instance of an
Invocation object. |
Modifier and Type | Method and Description |
---|---|
void |
MockCreationListener.onMockCreated(Object mock,
MockCreationSettings settings)
Mock object was just created.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
MockMaker.createMock(MockCreationSettings<T> settings,
MockHandler handler)
If you want to provide your own implementation of
MockMaker this method should:
Create a proxy object that implements settings.typeToMock and potentially also settings.extraInterfaces .
You may use the information from settings to create/configure your proxy object.
Your proxy object should carry the handler with it. |
org.mockito.internal.creation.instance.Instantiator |
InstantiatorProvider.getInstantiator(MockCreationSettings<?> settings)
Deprecated.
|
Instantiator |
InstantiatorProvider2.getInstantiator(MockCreationSettings<?> settings)
Returns an instantiator, used to create new class instances.
|
void |
MockMaker.resetMock(Object mock,
MockHandler newHandler,
MockCreationSettings settings)
Replaces the existing handler on
mock with newHandler . |