Uses of Annotation Interface
org.mockito.Incubating
Packages that use Incubating
Package
Description
Mockito is a mock library for java - see
Mockito
class for usage.ByteBuddy related stuff.
Public API related to mock method invocations.
Mockito JUnit integration ; rule and runners.
Public classes relative to the listener APIs.
Mock settings related classes.
Mockito plugins allow customization of behavior.
Mocking quality related classes.
Stubbing related classes.
Verification related classes.
-
Uses of Incubating in org.mockito
Classes in org.mockito with annotations of type IncubatingModifier and TypeInterfaceDescriptioninterface
Represents a mock of any object construction of the represented type.interface
MockedStatic<T>
Represents an active mock of a type's static methods.interface
Mockito framework settings and lifecycle listeners, for advanced users or for integrating with other frameworks.interface
MockitoSession
is an optional, highly recommended feature that helps driving cleaner tests by eliminating boilerplate code and adding extra validation.interface
Represents a mock with a thread-local explicit scope.Methods in org.mockito with annotations of type IncubatingModifier and TypeMethodDescriptionMockitoFramework.addListener
(MockitoListener listener) Adds listener to Mockito.static <T,
A> Answer<T> Creates an answer from a functional interface - allows for a strongly typed answer to be created ideally in Java 8static <T,
A, B> Answer<T> Creates an answer from a functional interface - allows for a strongly typed answer to be created ideally in Java 8static <T,
A, B, C> Answer<T> Creates an answer from a functional interface - allows for a strongly typed answer to be created ideally in Java 8static <T,
A, B, C, D>
Answer<T>Creates an answer from a functional interface - allows for a strongly typed answer to be created ideally in Java 8static <T,
A, B, C, D, E>
Answer<T>Creates an answer from a functional interface - allows for a strongly typed answer to be created ideally in Java 8static <T,
A, B, C, D, E, F>
Answer<T>Creates an answer from a functional interface - allows for a strongly typed answer to be created idiomatically in Java 8static <T> Answer<T>
AdditionalAnswers.answersWithDelay
(long sleepyTime, Answer<T> answer) Returns an answer after a delay with a defined length.AdditionalAnswers.answerVoid
(VoidAnswer1<A> answer) Creates an answer from a functional interface - allows for a strongly typed answer to be created ideally in Java 8AdditionalAnswers.answerVoid
(VoidAnswer2<A, B> answer) Creates an answer from a functional interface - allows for a strongly typed answer to be created ideally in Java 8AdditionalAnswers.answerVoid
(VoidAnswer3<A, B, C> answer) Creates an answer from a functional interface - allows for a strongly typed answer to be created ideally in Java 8AdditionalAnswers.answerVoid
(VoidAnswer4<A, B, C, D> answer) Creates an answer from a functional interface - allows for a strongly typed answer to be created ideally in Java 8AdditionalAnswers.answerVoid
(VoidAnswer5<A, B, C, D, E> answer) Creates an answer from a functional interface - allows for a strongly typed answer to be created ideally in Java 8AdditionalAnswers.answerVoid
(VoidAnswer6<A, B, C, D, E, F> answer) Creates an answer from a functional interface - allows for a strongly typed answer to be created idiomatically in Java 8<T> MockCreationSettings<T>
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.void
MockitoFramework.clearInlineMock
(Object mock) Clears up internal state of specific inline mock.void
MockitoFramework.clearInlineMocks()
Clears up internal state of all inline mocks.void
MockitoSession.finishMocking()
Must be invoked when the user is done with mocking for given session (test method).void
MockitoSession.finishMocking
(Throwable failure) Must be invoked when the user is done with mocking for given session (test method).static MockitoFramework
Mockito.framework()
For advanced users or framework integrators.MockitoFramework.getInvocationFactory()
Returns a factory that can create instances ofInvocation
.MockingDetails.getMockHandler()
Returns theMockHandler
associated with this mock object.MockitoFramework.getPlugins()
Returns an object that has access to Mockito plugins.static LenientStubber
Mockito.lenient()
Lenient stubs bypass "strict stubbing" validation (seeStrictness.STRICT_STUBS
).MockSettings.lenient()
Lenient mocks bypass "strict stubbing" validation (seeStrictness.STRICT_STUBS
).static <T> MockedConstruction<T>
Mockito.mockConstruction
(Class<T> classToMock) Creates a thread-local mock controller for all constructions of the given class.static <T> MockedConstruction<T>
Mockito.mockConstruction
(Class<T> classToMock, Function<MockedConstruction.Context, MockSettings> mockSettingsFactory) Creates a thread-local mock controller for all constructions of the given class.static <T> MockedConstruction<T>
Mockito.mockConstruction
(Class<T> classToMock, Function<MockedConstruction.Context, MockSettings> mockSettingsFactory, MockedConstruction.MockInitializer<T> mockInitializer) Creates a thread-local mock controller for all constructions of the given class.static <T> MockedConstruction<T>
Mockito.mockConstruction
(Class<T> classToMock, MockedConstruction.MockInitializer<T> mockInitializer) Creates a thread-local mock controller for all constructions of the given class.static <T> MockedConstruction<T>
Mockito.mockConstruction
(Class<T> classToMock, MockSettings mockSettings) Creates a thread-local mock controller for all constructions of the given class.static <T> MockedConstruction<T>
Mockito.mockConstruction
(Class<T> classToMock, MockSettings mockSettings, MockedConstruction.MockInitializer<T> mockInitializer) Creates a thread-local mock controller for all constructions of the given class.static <T> MockedConstruction<T>
Mockito.mockConstructionWithAnswer
(Class<T> classToMock, Answer defaultAnswer, Answer... additionalAnswers) Creates a thread-local mock controller for all constructions of the given class.static MockitoSessionBuilder
Mockito.mockitoSession()
MockitoSession
is an optional, highly recommended feature that helps driving cleaner tests by eliminating boilerplate code and adding extra validation.static <T> MockedStatic<T>
Mockito.mockStatic
(Class<T> classToMock) Creates a thread-local mock controller for all static methods of the given class or interface.static <T> MockedStatic<T>
Mockito.mockStatic
(Class<T> classToMock, String name) Creates a thread-local mock controller for all static methods of the given class or interface.static <T> MockedStatic<T>
Mockito.mockStatic
(Class<T> classToMock, MockSettings mockSettings) Creates a thread-local mock controller for all static methods of the given class or interface.static <T> MockedStatic<T>
Mockito.mockStatic
(Class<T> classToMock, Answer defaultAnswer) Creates a thread-local mock controller for all static methods of the given class or interface.MockSettings.outerInstance
(Object outerClassInstance) Makes it possible to mock non-static inner classes in conjunction withMockSettings.useConstructor(Object...)
.MockitoFramework.removeListener
(MockitoListener listener) When you add listener usingMockitoFramework.addListener(MockitoListener)
make sure to remove it.void
MockitoSession.setStrictness
(Strictness strictness) Changes the strictness of thisMockitoSession
.static <T> T
Please refer to the documentation ofMockito.spy(Object)
.MockSettings.useConstructor
(Object... args) Mockito attempts to use constructor when creating instance of the mock.MockSettings.verificationStartedListeners
(VerificationStartedListener... listeners) Registers a listener(s) that will be notified when user starts verification.MockSettings.withoutAnnotations()
By default, Mockito makes an attempt to preserve all annotation meta data on the mocked type and its methods to mirror the mocked type as closely as possible. -
Uses of Incubating in org.mockito.internal.creation.bytebuddy
Classes in org.mockito.internal.creation.bytebuddy with annotations of type IncubatingModifier and TypeClassDescription(package private) class
This is responsible for serializing a mock, it is enabled if the mock is implementingSerializable
.class
(package private) class
Agent and subclass based mock maker.Methods in org.mockito.internal.creation.bytebuddy with annotations of type Incubating -
Uses of Incubating in org.mockito.invocation
Classes in org.mockito.invocation with annotations of type IncubatingModifier and TypeInterfaceDescriptioninterface
Although this class is a part of public API, please don't provide your own implementations.interface
Available viaMockitoFramework.getInvocationFactory()
.Methods in org.mockito.invocation with annotations of type IncubatingModifier and TypeMethodDescriptionInvocationFactory.createInvocation
(Object target, MockCreationSettings settings, Method method, InvocationFactory.RealMethodBehavior realMethod, Object... args) Creates instance of anInvocation
object.MockHandler.getInvocationContainer()
Returns the object that holds all invocations on the mock object, including stubbings with declared answers.MockHandler.getMockSettings()
Read-only settings the mock object was created with. -
Uses of Incubating in org.mockito.junit
Classes in org.mockito.junit with annotations of type IncubatingModifier and TypeInterfaceDescriptioninterface
Use this rule in order to collect multiple verification failures and report at once.Methods in org.mockito.junit with annotations of type IncubatingModifier and TypeMethodDescriptionVerificationCollector.assertLazily()
Enforce all verifications are performed lazily.void
VerificationCollector.collectAndReport()
Collect all lazily verified behaviour.static VerificationCollector
MockitoJUnit.collector()
Creates a rule instance that can perform lazy verifications.MockitoRule.strictness
(Strictness strictness) The strictness, especially "strict stubs" (Strictness.STRICT_STUBS
) helps debugging and keeping tests clean.MockitoTestRule.strictness
(Strictness strictness) Equivalent toMockitoRule.strictness(Strictness)
. -
Uses of Incubating in org.mockito.listeners
Classes in org.mockito.listeners with annotations of type IncubatingModifier and TypeInterfaceDescriptioninterface
This listener can be notified of verify invocations on a mock.interface
The instance of this class is passed toVerificationStartedListener
.interface
This listener gets notified when the user starts verification.Methods in org.mockito.listeners with annotations of type IncubatingModifier and TypeMethodDescriptionVerificationStartedEvent.getMock()
The mock object that will be used during verification.void
VerificationStartedListener.onVerificationStarted
(VerificationStartedEvent event) Triggered when the user callsMockito.verify()
.void
Replaces existing mock object for verification with a different one. -
Uses of Incubating in org.mockito.mock
Classes in org.mockito.mock with annotations of type IncubatingMethods in org.mockito.mock with annotations of type IncubatingModifier and TypeMethodDescriptionObject[]
MockCreationSettings.getConstructorArgs()
Used when arguments should be passed to the mocked object's constructor, regardless of whether these arguments are supplied directly, or whether they include the outer instance.MockCreationSettings.getOuterClassInstance()
Used when mocking non-static inner classes in conjunction withMockCreationSettings.isUsingConstructor()
MockCreationSettings.getVerificationStartedListeners()
VerificationStartedListener
instances attached to this mock, seeMockSettings.verificationStartedListeners(VerificationStartedListener...)
boolean
MockCreationSettings.isLenient()
Informs if the mock was created with "lenient" strictness, e.g.boolean
MockCreationSettings.isUsingConstructor()
Informs whether the mock instance should be created via constructor -
Uses of Incubating in org.mockito.plugins
Classes in org.mockito.plugins with annotations of type IncubatingModifier and TypeInterfaceDescriptioninterface
Extension toMockMaker
for mock makers that changes inline method implementations and need keep track of created mock objects.interface
A member accessor is responsible for invoking methods, constructors and for setting and reading field values.interface
Mockito logger.static interface
static interface
static interface
Carries the mockability informationinterface
Allows switching off the plugins that are discovered on classpath.Methods in org.mockito.plugins with annotations of type IncubatingModifier and TypeMethodDescriptiondefault void
MockMaker.clearAllCaches()
Clears all cashes for mocked types and removes all byte code alterations, if possible.void
InlineMockMaker.clearAllMocks()
Cleans up internal state for all existing mocks.void
Clean up internal state for specifiedmock
.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 ofMockMaker
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.default <T> MockMaker.StaticMockControl<T>
MockMaker.createStaticMock
(Class<T> type, MockCreationSettings<T> settings, MockHandler handler) If you want to provide your own implementation ofMockMaker
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.MockMaker.isTypeMockable
(Class<?> type) Indicates if the given type can be mocked by this mockmaker.void
Log specified object. -
Uses of Incubating in org.mockito.quality
Classes in org.mockito.quality with annotations of type IncubatingModifier and TypeClassDescriptionenum
Configures the "strictness" of Mockito, affecting the behavior of stubbings and verification. -
Uses of Incubating in org.mockito.session
Classes in org.mockito.session with annotations of type IncubatingModifier and TypeInterfaceDescriptioninterface
Fluent builder interface forMockitoSession
objects.interface
Logger for hints emitted when finishing mocking for aMockitoSession
.Methods in org.mockito.session with annotations of type IncubatingModifier and TypeMethodDescriptionAdds the test class instance for initialization of fields annotated with Mockito annotations likeMock
.Adds the test class instances for initialization of fields annotated with Mockito annotations likeMock
.void
Logs the hint.MockitoSessionBuilder.logger
(MockitoSessionLogger logger) Configures logger used byMockitoSession
for emitting warnings when finishing the session.Configures the name of theMockitoSession
instance.MockitoSessionBuilder.startMocking()
Starts new mocking session! Creates newMockitoSession
instance to initialize the session.MockitoSessionBuilder.strictness
(Strictness strictness) Configures strictness ofMockitoSession
instance. -
Uses of Incubating in org.mockito.stubbing
Classes in org.mockito.stubbing with annotations of type IncubatingModifier and TypeInterfaceDescriptioninterface
Answer1<T,
A0> Generic interface to be used for configuring mock's answer for a single argument invocation.interface
Answer2<T,
A0, A1> Generic interface to be used for configuring mock's answer for a two argument invocation.interface
Answer3<T,
A0, A1, A2> Generic interface to be used for configuring mock's answer for a three argument invocation.interface
Answer4<T,
A0, A1, A2, A3> Generic interface to be used for configuring mock's answer for a four argument invocation.interface
Answer5<T,
A0, A1, A2, A3, A4> Generic interface to be used for configuring mock's answer for a five argument invocation.interface
Answer6<T,
A0, A1, A2, A3, A4, A5> Generic interface to be used for configuring mock's answer for a six argument invocation.interface
Allow to validate this answer is correct for the given invocation.interface
VoidAnswer1<A0>
Generic interface to be used for configuring mock's answer for a single argument invocation that returns nothing.interface
VoidAnswer2<A0,
A1> Generic interface to be used for configuring mock's answer for a two argument invocation that returns nothing.interface
VoidAnswer3<A0,
A1, A2> Generic interface to be used for configuring mock's answer for a three argument invocation that returns nothing.interface
VoidAnswer4<A0,
A1, A2, A3> Generic interface to be used for configuring mock's answer for a four argument invocation that returns nothing.interface
VoidAnswer5<A0,
A1, A2, A3, A4> Generic interface to be used for configuring mock's answer for a five argument invocation that returns nothing.interface
VoidAnswer6<A0,
A1, A2, A3, A4, A5> Generic interface to be used for configuring mock's answer for a six argument invocation that returns nothing.Methods in org.mockito.stubbing with annotations of type IncubatingModifier and TypeMethodDescriptionStubbing.getStrictness()
Informs about theStrictness
level of this stubbing. -
Uses of Incubating in org.mockito.verification
Classes in org.mockito.verification with annotations of type IncubatingModifier and TypeInterfaceDescriptioninterface
Contains all information about a verification that has happened.