Package | Description |
---|---|
org.mockito |
Mockito is a mock library for java - see
Mockito class for for usage. |
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.
|
Modifier and Type | Interface and Description |
---|---|
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. |
Modifier and Type | Method and 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 8
|
static <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 8
|
static <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 8
|
static <T,A,B,C,D> |
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 8
|
static <T,A,B,C,D,E> |
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 8
|
static <A> Answer<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 8
|
static <A,B> Answer<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 8
|
static <A,B,C> Answer<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 8
|
static <A,B,C,D> Answer<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 8
|
static <A,B,C,D,E> |
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 8
|
void |
MockitoSession.finishMocking()
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.
|
static MockitoSessionBuilder |
Mockito.mockitoSession()
MockitoSession is an optional, highly recommended feature
that helps driving cleaner tests by eliminating boilerplate code and adding extra validation. |
MockSettings |
MockSettings.outerInstance(Object outerClassInstance)
Makes it possible to mock non-static inner classes in conjunction with
MockSettings.useConstructor(Object...) . |
MockitoFramework |
MockitoFramework.removeListener(MockitoListener listener)
When you add listener using
MockitoFramework.addListener(MockitoListener) make sure to remove it. |
static <T> T |
Mockito.spy(Class<T> classToSpy)
Please refer to the documentation of
Mockito.spy(Object) . |
MockSettings |
MockSettings.useConstructor(Object... args)
Mockito attempts to use constructor when creating instance of the mock.
|
Modifier and Type | Interface and Description |
---|---|
interface |
VerificationCollector
Use this rule in order to collect multiple verification failures and report at once.
|
Modifier and Type | Method and 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. |
Modifier and Type | Interface and Description |
---|---|
interface |
VerificationListener
This listener can be notified of verify invocations on a mock.
|
Modifier and Type | Class and Description |
---|---|
class |
SerializableMode
Mock serializable style.
|
Modifier and Type | Method and Description |
---|---|
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.
|
Object |
MockCreationSettings.getOuterClassInstance()
Used when mocking non-static inner classes in conjunction with
MockCreationSettings.isUsingConstructor() |
boolean |
MockCreationSettings.isUsingConstructor()
Informs whether the mock instance should be created via constructor
|
Modifier and Type | Interface and Description |
---|---|
static interface |
MockMaker.TypeMockability
Carries the mockability information
|
interface |
PluginSwitch
Allows switching off the plugins that are discovered on classpath.
|
Modifier and Type | Method and Description |
---|---|
MockMaker.TypeMockability |
MockMaker.isTypeMockable(Class<?> type)
Indicates if the given type can be mocked by this mockmaker.
|
Modifier and Type | Class and Description |
---|---|
class |
Strictness
Configures the "strictness" of Mockito during a mocking session.
|
Modifier and Type | Interface and Description |
---|---|
interface |
MockitoSessionBuilder
Fluent builder interface for
MockitoSession objects. |
Modifier and Type | Method and Description |
---|---|
MockitoSessionBuilder |
MockitoSessionBuilder.initMocks(Object testClassInstance)
Configures the test class instance for initialization of fields annotated with Mockito annotations
like
Mock . |
MockitoSession |
MockitoSessionBuilder.startMocking()
Starts new mocking session! Creates new
MockitoSession instance to initialize the session. |
MockitoSessionBuilder |
MockitoSessionBuilder.strictness(Strictness strictness)
Configures strictness of
MockitoSession instance. |
Modifier and Type | Interface and 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 |
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.
|
Modifier and Type | Interface and Description |
---|---|
interface |
VerificationEvent
Contains all information about a verification that has happened.
|