Uses of Class
org.mockito.Incubating
-
Packages that use Incubating Package Description org.mockito Mockito is a mock library for java - seeMockito
class for usage.org.mockito.internal.creation.bytebuddy ByteBuddy related stuff.org.mockito.invocation Public API related to mock method invocations.org.mockito.junit Mockito JUnit integration ; rule and runners.org.mockito.listeners Public classes relative to the listener APIs.org.mockito.mock Mock settings related classes.org.mockito.plugins Mockito plugins allow customization of behavior.org.mockito.quality Mocking quality related classes.org.mockito.session org.mockito.stubbing Stubbing related classes.org.mockito.verification Verification related classes. -
-
Uses of Incubating in org.mockito
Classes in org.mockito with annotations of type Incubating Modifier and Type Interface Description interface
MockedConstruction<T>
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
MockitoFramework
Mockito framework settings and lifecycle listeners, for advanced users or for integrating with other frameworks.interface
MockitoSession
MockitoSession
is an optional, highly recommended feature that helps driving cleaner tests by eliminating boilerplate code and adding extra validation.interface
ScopedMock
Represents a mock with a thread-local explicit scope.Methods in org.mockito with annotations of type Incubating Modifier and Type Method Description MockitoFramework
MockitoFramework. addListener(MockitoListener listener)
Adds listener to Mockito.static <T,A>
Answer<T>AdditionalAnswers. answer(Answer1<T,A> answer)
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>AdditionalAnswers. answer(Answer2<T,A,B> answer)
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>AdditionalAnswers. answer(Answer3<T,A,B,C> answer)
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>AdditionalAnswers. answer(Answer4<T,A,B,C,D> answer)
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>AdditionalAnswers. answer(Answer5<T,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 8static <T,A,B,C,D,E,F>
Answer<T>AdditionalAnswers. answer(Answer6<T,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 8static <T> Answer<T>
AdditionalAnswers. answersWithDelay(long sleepyTime, Answer<T> answer)
Returns an answer after a delay with a defined length.static <A> Answer<java.lang.Void>
AdditionalAnswers. answerVoid(VoidAnswer1<A> answer)
Creates an answer from a functional interface - allows for a strongly typed answer to be created ideally in Java 8static <A,B>
Answer<java.lang.Void>AdditionalAnswers. answerVoid(VoidAnswer2<A,B> answer)
Creates an answer from a functional interface - allows for a strongly typed answer to be created ideally in Java 8static <A,B,C>
Answer<java.lang.Void>AdditionalAnswers. 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 8static <A,B,C,D>
Answer<java.lang.Void>AdditionalAnswers. 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 8static <A,B,C,D,E>
Answer<java.lang.Void>AdditionalAnswers. 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 8static <A,B,C,D,E,F>
Answer<java.lang.Void>AdditionalAnswers. 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>
MockSettings. build(java.lang.Class<T> typeToMock)
Creates immutable view of mock settings used later by Mockito.<T> MockCreationSettings<T>
MockSettings. buildStatic(java.lang.Class<T> classToMock)
Creates immutable view of mock settings used later by Mockito, for use within a static mocking.void
MockitoFramework. clearInlineMock(java.lang.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(java.lang.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.InvocationFactory
MockitoFramework. getInvocationFactory()
Returns a factory that can create instances ofInvocation
.MockHandler
MockingDetails. getMockHandler()
Returns theMockHandler
associated with this mock object.MockitoPlugins
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
MockSettings. lenient()
Lenient mocks bypass "strict stubbing" validation (seeStrictness.STRICT_STUBS
).static <T> MockedConstruction<T>
Mockito. mockConstruction(java.lang.Class<T> classToMock)
Creates a thread-local mock controller for all constructions of the given class.static <T> MockedConstruction<T>
Mockito. mockConstruction(java.lang.Class<T> classToMock, java.util.function.Function<MockedConstruction.Context,MockSettings> mockSettingsFactory)
Creates a thread-local mock controller for all constructions of the given class.static <T> MockedConstruction<T>
Mockito. mockConstruction(java.lang.Class<T> classToMock, java.util.function.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(java.lang.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(java.lang.Class<T> classToMock, MockSettings mockSettings)
Creates a thread-local mock controller for all constructions of the given class.static <T> MockedConstruction<T>
Mockito. mockConstruction(java.lang.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(java.lang.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(java.lang.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(java.lang.Class<T> classToMock, java.lang.String name)
Creates a thread-local mock controller for all static methods of the given class or interface.static <T> MockedStatic<T>
Mockito. mockStatic(java.lang.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(java.lang.Class<T> classToMock, Answer defaultAnswer)
Creates a thread-local mock controller for all static methods of the given class or interface.MockSettings
MockSettings. outerInstance(java.lang.Object outerClassInstance)
Makes it possible to mock non-static inner classes in conjunction withMockSettings.useConstructor(Object...)
.MockitoFramework
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
Mockito. spy(java.lang.Class<T> classToSpy)
Please refer to the documentation ofMockito.spy(Object)
.MockSettings
MockSettings. useConstructor(java.lang.Object... args)
Mockito attempts to use constructor when creating instance of the mock.MockSettings
MockSettings. verificationStartedListeners(VerificationStartedListener... listeners)
Registers a listener(s) that will be notified when user starts verification.MockSettings
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 Incubating Modifier and Type Class Description (package private) class
ByteBuddyCrossClassLoaderSerializationSupport
This is responsible for serializing a mock, it is enabled if the mock is implementingSerializable
.class
InlineByteBuddyMockMaker
(package private) class
InlineDelegateByteBuddyMockMaker
Agent and subclass based mock maker.Methods in org.mockito.internal.creation.bytebuddy with annotations of type Incubating Modifier and Type Method Description MockMaker.TypeMockability
ByteBuddyMockMaker. isTypeMockable(java.lang.Class<?> type)
-
Uses of Incubating in org.mockito.invocation
Classes in org.mockito.invocation with annotations of type Incubating Modifier and Type Interface Description interface
InvocationContainer
Although this class is a part of public API, please don't provide your own implementations.interface
InvocationFactory
Available viaMockitoFramework.getInvocationFactory()
.Methods in org.mockito.invocation with annotations of type Incubating Modifier and Type Method Description Invocation
InvocationFactory. createInvocation(java.lang.Object target, MockCreationSettings settings, java.lang.reflect.Method method, InvocationFactory.RealMethodBehavior realMethod, java.lang.Object... args)
Creates instance of anInvocation
object.InvocationContainer
MockHandler. getInvocationContainer()
Returns the object that holds all invocations on the mock object, including stubbings with declared answers.MockCreationSettings<T>
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 Incubating Modifier and Type Interface Description interface
VerificationCollector
Use this rule in order to collect multiple verification failures and report at once.Methods in org.mockito.junit with annotations of type Incubating Modifier and Type Method Description VerificationCollector
VerificationCollector. 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
MockitoRule. strictness(Strictness strictness)
The strictness, especially "strict stubs" (Strictness.STRICT_STUBS
) helps debugging and keeping tests clean.MockitoTestRule
MockitoTestRule. strictness(Strictness strictness)
Equivalent toMockitoRule.strictness(Strictness)
. -
Uses of Incubating in org.mockito.listeners
Classes in org.mockito.listeners with annotations of type Incubating Modifier and Type Interface Description interface
VerificationListener
This listener can be notified of verify invocations on a mock.interface
VerificationStartedEvent
The instance of this class is passed toVerificationStartedListener
.interface
VerificationStartedListener
This listener gets notified when the user starts verification.Methods in org.mockito.listeners with annotations of type Incubating Modifier and Type Method Description java.lang.Object
VerificationStartedEvent. getMock()
The mock object that will be used during verification.void
VerificationStartedListener. onVerificationStarted(VerificationStartedEvent event)
Triggered when the user callsMockito.verify()
.void
VerificationStartedEvent. setMock(java.lang.Object mock)
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 Incubating Modifier and Type Class Description class
SerializableMode
Mock serializable style.Methods in org.mockito.mock with annotations of type Incubating Modifier and Type Method Description java.lang.Object[]
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.java.lang.Object
MockCreationSettings. getOuterClassInstance()
Used when mocking non-static inner classes in conjunction withMockCreationSettings.isUsingConstructor()
java.util.List<VerificationStartedListener>
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 Incubating Modifier and Type Interface Description interface
InlineMockMaker
Extension toMockMaker
for mock makers that changes inline method implementations and need keep track of created mock objects.interface
MemberAccessor
A member accessor is responsible for invoking methods, constructors and for setting and reading field values.interface
MockitoLogger
Mockito logger.static interface
MockMaker.ConstructionMockControl<T>
static interface
MockMaker.StaticMockControl<T>
static interface
MockMaker.TypeMockability
Carries the mockability informationinterface
PluginSwitch
Allows switching off the plugins that are discovered on classpath.Methods in org.mockito.plugins with annotations of type Incubating Modifier and Type Method Description default 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
InlineMockMaker. clearMock(java.lang.Object mock)
Clean up internal state for specifiedmock
.default <T> MockMaker.ConstructionMockControl<T>
MockMaker. createConstructionMock(java.lang.Class<T> type, java.util.function.Function<MockedConstruction.Context,MockCreationSettings<T>> settingsFactory, java.util.function.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(java.lang.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.TypeMockability
MockMaker. isTypeMockable(java.lang.Class<?> type)
Indicates if the given type can be mocked by this mockmaker.void
MockitoLogger. log(java.lang.Object what)
Log specified object. -
Uses of Incubating in org.mockito.quality
Classes in org.mockito.quality with annotations of type Incubating Modifier and Type Class Description class
Strictness
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 Incubating Modifier and Type Interface Description interface
MockitoSessionBuilder
Fluent builder interface forMockitoSession
objects.interface
MockitoSessionLogger
Logger for hints emitted when finishing mocking for aMockitoSession
.Methods in org.mockito.session with annotations of type Incubating Modifier and Type Method Description MockitoSessionBuilder
MockitoSessionBuilder. initMocks(java.lang.Object testClassInstance)
Adds the test class instance for initialization of fields annotated with Mockito annotations likeMock
.MockitoSessionBuilder
MockitoSessionBuilder. initMocks(java.lang.Object... testClassInstances)
Adds the test class instances for initialization of fields annotated with Mockito annotations likeMock
.void
MockitoSessionLogger. log(java.lang.String hint)
Logs the hint.MockitoSessionBuilder
MockitoSessionBuilder. logger(MockitoSessionLogger logger)
Configures logger used byMockitoSession
for emitting warnings when finishing the session.MockitoSessionBuilder
MockitoSessionBuilder. name(java.lang.String name)
Configures the name of theMockitoSession
instance.MockitoSession
MockitoSessionBuilder. startMocking()
Starts new mocking session! Creates newMockitoSession
instance to initialize the session.MockitoSessionBuilder
MockitoSessionBuilder. strictness(Strictness strictness)
Configures strictness ofMockitoSession
instance. -
Uses of Incubating in org.mockito.stubbing
Classes in org.mockito.stubbing with annotations of type Incubating Modifier and Type Interface Description interface
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
ValidableAnswer
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 Incubating Modifier and Type Method Description Strictness
Stubbing. getStrictness()
Informs about theStrictness
level of this stubbing. -
Uses of Incubating in org.mockito.verification
Classes in org.mockito.verification with annotations of type Incubating Modifier and Type Interface Description interface
VerificationEvent
Contains all information about a verification that has happened.
-