| Package | Description |
|---|---|
| org.mockito |
Mockito is a mock library for java - see
Mockito class for usage. |
| org.mockito.internal.creation |
Mock object creation.
|
| org.mockito.internal.creation.bytebuddy |
ByteBuddy related stuff.
|
| org.mockito.internal.creation.instance | |
| org.mockito.internal.creation.proxy |
Mock makers based on the
Proxy utility. |
| org.mockito.internal.creation.settings | |
| org.mockito.internal.handler | |
| org.mockito.internal.invocation |
Invocation machinery and related classes.
|
| org.mockito.internal.junit |
JUnit integration support classes.
|
| org.mockito.internal.progress |
Mocking progress stateful classes.
|
| org.mockito.internal.stubbing |
Stubbing logic.
|
| org.mockito.internal.util |
Static utils
|
| 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.
|
<T> MockCreationSettings<T> |
MockSettings.buildStatic(Class<T> classToMock)
Creates immutable view of mock settings used later by Mockito, for use within a static mocking.
|
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 | Class and Description |
|---|---|
class |
MockSettingsImpl<T> |
| Modifier and Type | Method and Description |
|---|---|
<T2> MockCreationSettings<T2> |
MockSettingsImpl.build(Class<T2> typeToMock) |
<T2> MockCreationSettings<T2> |
MockSettingsImpl.buildStatic(Class<T2> classToMock) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
ByteBuddyMockMaker.createMock(MockCreationSettings<T> settings,
MockHandler handler) |
<T> T |
SubclassByteBuddyMockMaker.createMock(MockCreationSettings<T> settings,
MockHandler handler) |
<T> T |
InlineByteBuddyMockMaker.createMock(MockCreationSettings<T> settings,
MockHandler handler) |
<T> Class<? extends T> |
ByteBuddyMockMaker.createMockType(MockCreationSettings<T> creationSettings) |
<T> Class<? extends T> |
SubclassByteBuddyMockMaker.createMockType(MockCreationSettings<T> settings) |
<T> Class<? extends T> |
InlineByteBuddyMockMaker.createMockType(MockCreationSettings<T> settings) |
<T> Optional<T> |
ByteBuddyMockMaker.createSpy(MockCreationSettings<T> settings,
MockHandler handler,
T object) |
<T> Optional<T> |
InlineByteBuddyMockMaker.createSpy(MockCreationSettings<T> settings,
MockHandler handler,
T instance) |
<T> MockMaker.StaticMockControl<T> |
ByteBuddyMockMaker.createStaticMock(Class<T> type,
MockCreationSettings<T> settings,
MockHandler handler) |
<T> MockMaker.StaticMockControl<T> |
InlineByteBuddyMockMaker.createStaticMock(Class<T> type,
MockCreationSettings<T> settings,
MockHandler handler) |
void |
ByteBuddyMockMaker.resetMock(Object mock,
MockHandler newHandler,
MockCreationSettings settings) |
void |
SubclassByteBuddyMockMaker.resetMock(Object mock,
MockHandler newHandler,
MockCreationSettings settings) |
void |
InlineByteBuddyMockMaker.resetMock(Object mock,
MockHandler newHandler,
MockCreationSettings settings) |
| Modifier and Type | Method and Description |
|---|---|
<T> MockMaker.ConstructionMockControl<T> |
ByteBuddyMockMaker.createConstructionMock(Class<T> type,
Function<MockedConstruction.Context,MockCreationSettings<T>> settingsFactory,
Function<MockedConstruction.Context,MockHandler<T>> handlerFactory,
MockedConstruction.MockInitializer<T> mockInitializer) |
<T> MockMaker.ConstructionMockControl<T> |
InlineByteBuddyMockMaker.createConstructionMock(Class<T> type,
Function<MockedConstruction.Context,MockCreationSettings<T>> settingsFactory,
Function<MockedConstruction.Context,MockHandler<T>> handlerFactory,
MockedConstruction.MockInitializer<T> mockInitializer) |
| Constructor and Description |
|---|
MockMethodInterceptor(MockHandler handler,
MockCreationSettings mockCreationSettings) |
| Modifier and Type | Method and Description |
|---|---|
Instantiator |
InstantiatorProvider2Adapter.getInstantiator(MockCreationSettings<?> settings) |
Instantiator |
InstantiatorProviderAdapter.getInstantiator(MockCreationSettings<?> settings) |
Instantiator |
DefaultInstantiatorProvider.getInstantiator(MockCreationSettings<?> settings) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
ProxyMockMaker.createMock(MockCreationSettings<T> settings,
MockHandler handler) |
void |
ProxyMockMaker.resetMock(Object mock,
MockHandler newHandler,
MockCreationSettings settings) |
| Modifier and Type | Class and Description |
|---|---|
class |
CreationSettings<T> |
| Modifier and Type | Method and Description |
|---|---|
MockCreationSettings<T> |
MockHandlerImpl.getMockSettings() |
| Modifier and Type | Method and Description |
|---|---|
static <T> MockHandler<T> |
MockHandlerFactory.createMockHandler(MockCreationSettings<T> settings) |
| Constructor and Description |
|---|
MockHandlerImpl(MockCreationSettings<T> mockSettings) |
| Modifier and Type | Method and Description |
|---|---|
static InterceptedInvocation |
DefaultInvocationFactory.createInvocation(Object mock,
Method invokedMethod,
Object[] arguments,
RealMethod realMethod,
MockCreationSettings settings,
Location location) |
Invocation |
DefaultInvocationFactory.createInvocation(Object target,
MockCreationSettings settings,
Method method,
Callable realMethod,
Object... args) |
Invocation |
DefaultInvocationFactory.createInvocation(Object target,
MockCreationSettings settings,
Method method,
InvocationFactory.RealMethodBehavior realMethod,
Object... args) |
| Modifier and Type | Method and Description |
|---|---|
void |
UnnecessaryStubbingsReporter.onMockCreated(Object mock,
MockCreationSettings settings) |
void |
NoOpTestListener.onMockCreated(Object mock,
MockCreationSettings settings) |
void |
UniversalTestListener.onMockCreated(Object mock,
MockCreationSettings settings) |
void |
StrictStubsRunnerTestListener.onMockCreated(Object mock,
MockCreationSettings settings) |
void |
MismatchReportingTestListener.onMockCreated(Object mock,
MockCreationSettings settings) |
| Modifier and Type | Method and Description |
|---|---|
void |
MockingProgressImpl.mockingStarted(Class<?> mock,
MockCreationSettings settings) |
void |
MockingProgress.mockingStarted(Class<?> mock,
MockCreationSettings settings) |
void |
MockingProgressImpl.mockingStarted(Object mock,
MockCreationSettings settings) |
void |
MockingProgress.mockingStarted(Object mock,
MockCreationSettings settings) |
| Modifier and Type | Method and Description |
|---|---|
static Strictness |
StrictnessSelector.determineStrictness(Stubbing stubbing,
MockCreationSettings mockSettings,
Strictness testLevelStrictness)
Determines the actual strictness in the following importance order:
1st - strictness configured when declaring stubbing;
2nd - strictness configured at mock level;
3rd - strictness configured at test level (rule, mockito session)
|
| Constructor and Description |
|---|
InvocationContainerImpl(MockCreationSettings mockSettings) |
| Modifier and Type | Method and Description |
|---|---|
MockCreationSettings<?> |
DefaultMockingDetails.getMockCreationSettings() |
static MockCreationSettings |
MockUtil.getMockSettings(Object mock) |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
MockUtil.createMock(MockCreationSettings<T> settings) |
static <T> MockMaker.StaticMockControl<T> |
MockUtil.createStaticMock(Class<T> type,
MockCreationSettings<T> settings) |
| Modifier and Type | Method and Description |
|---|---|
static <T> MockMaker.ConstructionMockControl<T> |
MockUtil.createConstructionMock(Class<T> type,
Function<MockedConstruction.Context,MockCreationSettings<T>> settingsFactory,
MockedConstruction.MockInitializer<T> mockInitializer) |
| 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 |
|---|---|
MockCreationSettings |
StubbingLookupEvent.getMockSettings() |
| Modifier and Type | Method and Description |
|---|---|
void |
MockCreationListener.onMockCreated(Object mock,
MockCreationSettings settings)
Mock object was just created.
|
default void |
MockCreationListener.onStaticMockCreated(Class<?> mock,
MockCreationSettings settings)
Static 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. |
default <T> Optional<T> |
MockMaker.createSpy(MockCreationSettings<T> settings,
MockHandler handler,
T instance)
By implementing this method, a mock maker can optionally support the creation of spies where all fields
are set within a constructor.
|
default <T> MockMaker.StaticMockControl<T> |
MockMaker.createStaticMock(Class<T> type,
MockCreationSettings<T> settings,
MockHandler handler)
If you want to provide your own implementation of
MockMaker this method should:
Alter the supplied class to only change its behavior in the current thread.
Only alters the static method's behavior after being enabled.
Stops the altered behavior when disabled.
|
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. |
| Modifier and Type | Method and Description |
|---|---|
default <T> MockMaker.ConstructionMockControl<T> |
MockMaker.createConstructionMock(Class<T> type,
Function<MockedConstruction.Context,MockCreationSettings<T>> settingsFactory,
Function<MockedConstruction.Context,MockHandler<T>> handlerFactory,
MockedConstruction.MockInitializer<T> mockInitializer)
If you want to provide your own implementation of
MockMaker this method should:
Intercept all constructions of the specified type in the current thread
Only intercept the construction after being enabled.
Stops the interception when disabled.
|
Copyright © 2025. All rights reserved.