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.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.listeners | |
org.mockito.internal.progress |
Mocking progress stateful classes.
|
org.mockito.internal.stubbing |
Stubbing logic.
|
org.mockito.internal.stubbing.defaultanswers |
Implementations of default Answers.
|
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(java.lang.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 | Class and Description |
---|---|
class |
MockSettingsImpl<T> |
Modifier and Type | Method and Description |
---|---|
<T> MockCreationSettings<T> |
MockSettingsImpl.build(java.lang.Class<T> typeToMock) |
Modifier and Type | Field and Description |
---|---|
private MockCreationSettings |
MockMethodInterceptor.mockCreationSettings |
Modifier and Type | Method and Description |
---|---|
<T> T |
ByteBuddyMockMaker.createMock(MockCreationSettings<T> settings,
MockHandler handler) |
<T> T |
InlineByteBuddyMockMaker.createMock(MockCreationSettings<T> settings,
MockHandler handler) |
<T> T |
SubclassByteBuddyMockMaker.createMock(MockCreationSettings<T> settings,
MockHandler handler) |
<T> java.lang.Class<? extends T> |
ByteBuddyMockMaker.createMockType(MockCreationSettings<T> creationSettings) |
<T> java.lang.Class<? extends T> |
InlineByteBuddyMockMaker.createMockType(MockCreationSettings<T> settings) |
<T> java.lang.Class<? extends T> |
ClassCreatingMockMaker.createMockType(MockCreationSettings<T> settings) |
<T> java.lang.Class<? extends T> |
SubclassByteBuddyMockMaker.createMockType(MockCreationSettings<T> settings) |
private static <T> T |
SubclassByteBuddyMockMaker.ensureMockIsAssignableToMockedType(MockCreationSettings<T> settings,
T mock) |
private <T> java.lang.RuntimeException |
InlineByteBuddyMockMaker.prettifyFailure(MockCreationSettings<T> mockFeatures,
java.lang.Exception generationFailed) |
private <T> java.lang.RuntimeException |
SubclassByteBuddyMockMaker.prettifyFailure(MockCreationSettings<T> mockFeatures,
java.lang.Exception generationFailed) |
void |
ByteBuddyMockMaker.resetMock(java.lang.Object mock,
MockHandler newHandler,
MockCreationSettings settings) |
void |
InlineByteBuddyMockMaker.resetMock(java.lang.Object mock,
MockHandler newHandler,
MockCreationSettings settings) |
void |
SubclassByteBuddyMockMaker.resetMock(java.lang.Object mock,
MockHandler newHandler,
MockCreationSettings settings) |
Constructor and Description |
---|
MockMethodInterceptor(MockHandler handler,
MockCreationSettings mockCreationSettings) |
Modifier and Type | Method and Description |
---|---|
Instantiator |
DefaultInstantiatorProvider.getInstantiator(MockCreationSettings<?> settings) |
Instantiator |
InstantiatorProvider2Adapter.getInstantiator(MockCreationSettings<?> settings) |
Instantiator |
InstantiatorProviderAdapter.getInstantiator(MockCreationSettings<?> settings) |
Modifier and Type | Class and Description |
---|---|
class |
CreationSettings<T> |
Modifier and Type | Field and Description |
---|---|
private MockCreationSettings<T> |
MockHandlerImpl.mockSettings |
Modifier and Type | Method and Description |
---|---|
MockCreationSettings<T> |
NullResultGuardian.getMockSettings() |
MockCreationSettings<T> |
MockHandlerImpl.getMockSettings() |
MockCreationSettings<T> |
InvocationNotifierHandler.getMockSettings() |
Modifier and Type | Method and Description |
---|---|
static <T> MockHandler<T> |
MockHandlerFactory.createMockHandler(MockCreationSettings<T> settings) |
Constructor and Description |
---|
InvocationNotifierHandler(MockHandler<T> mockHandler,
MockCreationSettings<T> settings) |
MockHandlerImpl(MockCreationSettings<T> mockSettings) |
Modifier and Type | Method and Description |
---|---|
private static InterceptedInvocation |
DefaultInvocationFactory.createInvocation(java.lang.Object mock,
java.lang.reflect.Method invokedMethod,
java.lang.Object[] arguments,
RealMethod realMethod,
MockCreationSettings settings) |
static InterceptedInvocation |
DefaultInvocationFactory.createInvocation(java.lang.Object mock,
java.lang.reflect.Method invokedMethod,
java.lang.Object[] arguments,
RealMethod realMethod,
MockCreationSettings settings,
Location location) |
Invocation |
DefaultInvocationFactory.createInvocation(java.lang.Object target,
MockCreationSettings settings,
java.lang.reflect.Method method,
java.util.concurrent.Callable realMethod,
java.lang.Object... args) |
Invocation |
DefaultInvocationFactory.createInvocation(java.lang.Object target,
MockCreationSettings settings,
java.lang.reflect.Method method,
InvocationFactory.RealMethodBehavior realMethod,
java.lang.Object... args) |
private Invocation |
DefaultInvocationFactory.createInvocation(java.lang.Object target,
MockCreationSettings settings,
java.lang.reflect.Method method,
RealMethod superMethod,
java.lang.Object[] args) |
private static MockitoMethod |
DefaultInvocationFactory.createMockitoMethod(java.lang.reflect.Method method,
MockCreationSettings settings) |
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.Object,MockCreationSettings> |
UniversalTestListener.mocks |
Modifier and Type | Method and Description |
---|---|
void |
StrictStubsRunnerTestListener.onMockCreated(java.lang.Object mock,
MockCreationSettings settings) |
void |
MismatchReportingTestListener.onMockCreated(java.lang.Object mock,
MockCreationSettings settings) |
void |
UnnecessaryStubbingsReporter.onMockCreated(java.lang.Object mock,
MockCreationSettings settings) |
void |
UniversalTestListener.onMockCreated(java.lang.Object mock,
MockCreationSettings settings) |
void |
NoOpTestListener.onMockCreated(java.lang.Object mock,
MockCreationSettings settings) |
Modifier and Type | Field and Description |
---|---|
private MockCreationSettings |
StubbingLookupNotifier.Event.mockSettings |
Modifier and Type | Method and Description |
---|---|
MockCreationSettings |
StubbingLookupNotifier.Event.getMockSettings() |
MockCreationSettings |
StubbingLookupEvent.getMockSettings() |
Modifier and Type | Method and Description |
---|---|
(package private) static void |
VerificationStartedNotifier.assertCompatibleTypes(java.lang.Object mock,
MockCreationSettings originalSettings) |
Constructor and Description |
---|
Event(Invocation invocation,
Stubbing stubbing,
java.util.Collection<Stubbing> allStubbings,
MockCreationSettings mockSettings) |
Modifier and Type | Method and Description |
---|---|
void |
MockingProgressImpl.mockingStarted(java.lang.Object mock,
MockCreationSettings settings) |
void |
MockingProgress.mockingStarted(java.lang.Object mock,
MockCreationSettings settings) |
Modifier and Type | Method and Description |
---|---|
private RegisteredInvocations |
InvocationContainerImpl.createRegisteredInvocations(MockCreationSettings mockSettings) |
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 |
---|---|
private MockSettings |
ReturnsDeepStubs.propagateSerializationSettings(MockSettings mockSettings,
MockCreationSettings parentMockSettings) |
private MockSettings |
ReturnsDeepStubs.withSettingsUsing(GenericMetadataSupport returnTypeGenericMetadata,
MockCreationSettings parentMockSettings) |
Modifier and Type | Method and Description |
---|---|
MockCreationSettings<?> |
DefaultMockingDetails.getMockCreationSettings() |
static MockCreationSettings |
MockUtil.getMockSettings(java.lang.Object mock) |
Modifier and Type | Method and Description |
---|---|
static <T> T |
MockUtil.createMock(MockCreationSettings<T> settings) |
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(java.lang.Object target,
MockCreationSettings settings,
java.lang.reflect.Method method,
java.util.concurrent.Callable realMethod,
java.lang.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(java.lang.Object target,
MockCreationSettings settings,
java.lang.reflect.Method method,
InvocationFactory.RealMethodBehavior realMethod,
java.lang.Object... args)
Creates instance of an
Invocation object. |
Modifier and Type | Method and Description |
---|---|
void |
MockCreationListener.onMockCreated(java.lang.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. |
Instantiator |
InstantiatorProvider2.getInstantiator(MockCreationSettings<?> settings)
Returns an instantiator, used to create new class instances.
|
Instantiator |
InstantiatorProvider.getInstantiator(MockCreationSettings<?> settings)
Deprecated.
|
void |
MockMaker.resetMock(java.lang.Object mock,
MockHandler newHandler,
MockCreationSettings settings)
Replaces the existing handler on
mock with newHandler . |