Package | Description |
---|---|
org.mockito |
Mockito is a mock library for java - see Mockito class for for usage.
|
org.mockito.configuration |
Mockito configuration utilities
|
org.mockito.internal |
Internal classes, not to be used by clients.
|
org.mockito.internal.configuration |
Mockito configuration
|
org.mockito.internal.creation |
Mock object creation.
|
org.mockito.internal.creation.settings | |
org.mockito.internal.stubbing |
Stubbing logic.
|
org.mockito.internal.stubbing.answers |
Answers for stubbed calls
|
org.mockito.internal.stubbing.defaultanswers |
Implementations of ReturnValues
|
org.mockito.mock | |
org.mockito.stubbing |
External stubbing related classes
|
Modifier and Type | Class and Description |
---|---|
class |
Answers
Enumeration of pre-configured mock answers
|
Modifier and Type | Field and Description |
---|---|
static Answer<Object> |
Mockito.CALLS_REAL_METHODS
Optional
Answer to be used with Mockito.mock(Class, Answer) |
static Answer<Object> |
Mockito.RETURNS_DEEP_STUBS
Optional
Answer to be used with Mockito.mock(Class, Answer) . |
static Answer<Object> |
Mockito.RETURNS_DEFAULTS
The default
Answer of every mock if the mock was not stubbed. |
static Answer<Object> |
Mockito.RETURNS_MOCKS
Optional
Answer to be used with Mockito.mock(Class, Answer) |
static Answer<Object> |
Mockito.RETURNS_SMART_NULLS
Optional
Answer to be used with Mockito.mock(Class, Answer) . |
Modifier and Type | Method and Description |
---|---|
static <T> Answer<T> |
AdditionalAnswers.delegatesTo(Object delegate)
An answer that directly forwards the calls to the delegate.
|
Answer<Object> |
Answers.get()
Deprecated.
Use the enum-constant directly, instead of this getter. This method will be removed in a future release
E.g. instead of Answers.CALLS_REAL_METHODS.get() use Answers.CALLS_REAL_METHODS . |
static <T> Answer<T> |
AdditionalAnswers.returnsArgAt(int position)
Returns the parameter of an invocation at the given position.
|
static <T> Answer<T> |
AdditionalAnswers.returnsElementsOf(Collection<?> elements)
Returns elements of the collection.
|
static <T> Answer<T> |
AdditionalAnswers.returnsFirstArg()
Returns the first parameter of an invocation.
|
static <T> Answer<T> |
AdditionalAnswers.returnsLastArg()
Returns the last parameter of an invocation.
|
static <T> Answer<T> |
AdditionalAnswers.returnsSecondArg()
Returns the second parameter of an invocation.
|
Modifier and Type | Method and Description |
---|---|
MockSettings |
MockSettings.defaultAnswer(Answer defaultAnswer)
Specifies default answers to interactions.
|
static Stubber |
Mockito.doAnswer(Answer answer)
Use
doAnswer() when you want to stub a void method with generic Answer . |
static <T> T |
Mockito.mock(Class<T> classToMock,
Answer defaultAnswer)
Creates mock with a specified strategy for its answers to interactions.
|
BDDMockito.BDDMyOngoingStubbing<T> |
BDDMockito.BDDMyOngoingStubbing.will(Answer<?> answer)
See original
OngoingStubbing.then(Answer) |
BDDMockito.BDDMyOngoingStubbing<T> |
BDDMockito.BDDOngoingStubbingImpl.will(Answer<?> answer)
Deprecated.
|
static BDDMockito.BDDStubber |
BDDMockito.willAnswer(Answer answer)
see original
Mockito.doAnswer(Answer) |
BDDMockito.BDDStubber |
BDDMockito.BDDStubber.willAnswer(Answer answer)
See original
Stubber.doAnswer(Answer) |
BDDMockito.BDDStubber |
BDDMockito.BDDStubberImpl.willAnswer(Answer answer)
Deprecated.
|
BDDMockito.BDDMyOngoingStubbing<T> |
BDDMockito.BDDMyOngoingStubbing.willAnswer(Answer<?> answer)
See original
OngoingStubbing.thenAnswer(Answer) |
BDDMockito.BDDMyOngoingStubbing<T> |
BDDMockito.BDDOngoingStubbingImpl.willAnswer(Answer<?> answer)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
Answer<Object> |
DefaultMockitoConfiguration.getDefaultAnswer() |
Answer<Object> |
IMockitoConfiguration.getDefaultAnswer()
Allows configuring the default answers of unstubbed invocations
|
Modifier and Type | Method and Description |
---|---|
Stubber |
MockitoCore.doAnswer(Answer answer) |
Modifier and Type | Method and Description |
---|---|
void |
InternalMockHandler.setAnswersForStubbing(List<Answer> answers) |
Modifier and Type | Method and Description |
---|---|
Answer<Object> |
GlobalConfiguration.getDefaultAnswer() |
Modifier and Type | Method and Description |
---|---|
Answer<Object> |
MockSettingsImpl.getDefaultAnswer() |
Modifier and Type | Method and Description |
---|---|
MockSettings |
MockSettingsImpl.defaultAnswer(Answer defaultAnswer) |
Modifier and Type | Field and Description |
---|---|
protected Answer<Object> |
CreationSettings.defaultAnswer |
Modifier and Type | Method and Description |
---|---|
Answer<Object> |
CreationSettings.getDefaultAnswer() |
Modifier and Type | Class and Description |
---|---|
class |
StubbedInvocationMatcher |
Modifier and Type | Method and Description |
---|---|
void |
InvocationContainerImpl.addAnswer(Answer answer) |
void |
StubbedInvocationMatcher.addAnswer(Answer answer) |
void |
InvocationContainerImpl.addAnswer(Answer answer,
boolean isConsecutive) |
void |
InvocationContainerImpl.addAnswerForVoidMethod(Answer answer) |
void |
InvocationContainerImpl.addConsecutiveAnswer(Answer answer) |
Stubber |
StubberImpl.doAnswer(Answer answer) |
OngoingStubbing<T> |
ConsecutiveStubbing.then(Answer<?> answer) |
OngoingStubbing<T> |
OngoingStubbingImpl.then(Answer<?> answer) |
OngoingStubbing<T> |
ConsecutiveStubbing.thenAnswer(Answer<?> answer) |
OngoingStubbing<T> |
OngoingStubbingImpl.thenAnswer(Answer<?> answer) |
DeprecatedOngoingStubbing<T> |
ConsecutiveStubbing.toAnswer(Answer<?> answer) |
DeprecatedOngoingStubbing<T> |
OngoingStubbingImpl.toAnswer(Answer<?> answer) |
VoidMethodStubbable<T> |
VoidMethodStubbableImpl.toAnswer(Answer<?> answer) |
Modifier and Type | Method and Description |
---|---|
void |
InvocationContainerImpl.setAnswersForStubbing(List<Answer> answers) |
Constructor and Description |
---|
StubbedInvocationMatcher(InvocationMatcher invocation,
Answer answer) |
Modifier and Type | Class and Description |
---|---|
class |
AnswerReturnValuesAdapter |
class |
CallsRealMethods
Optional Answer that adds partial mocking support
|
class |
ClonesArguments |
class |
DoesNothing |
class |
Returns |
class |
ReturnsArgumentAt
Returns the passed parameter identity at specified index.
|
class |
ReturnsElementsOf
Returns elements of the collection.
|
class |
ThrowsException |
class |
ThrowsExceptionClass |
Modifier and Type | Method and Description |
---|---|
void |
AnswersValidator.validate(Answer<?> answer,
Invocation invocation) |
Modifier and Type | Class and Description |
---|---|
class |
ForwardsInvocations
Internal answer to forward invocations on a real instance.
|
class |
GloballyConfiguredAnswer
Globally configured Answer.
|
class |
ReturnsDeepStubs
Returning deep stub implementation.
|
class |
ReturnsEmptyValues
Default answer of every Mockito mock.
|
class |
ReturnsMocks |
class |
ReturnsMoreEmptyValues
It's likely this implementation will be used by default by every Mockito 2.0 mock.
|
class |
ReturnsSmartNulls
Optional Answer that can be used with
Mockito.mock(Class, Answer) |
Modifier and Type | Method and Description |
---|---|
Answer<Object> |
Answers.get()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
Answer |
MockCreationSettings.getDefaultAnswer()
the default answer for this mock, see
MockSettings.defaultAnswer(org.mockito.stubbing.Answer) . |
Modifier and Type | Method and Description |
---|---|
Stubber |
Stubber.doAnswer(Answer answer)
Use it for stubbing consecutive calls in
Mockito.doAnswer(Answer) style:
|
OngoingStubbing<T> |
OngoingStubbing.then(Answer<?> answer)
Sets a generic Answer for the method.
|
OngoingStubbing<T> |
OngoingStubbing.thenAnswer(Answer<?> answer)
Sets a generic Answer for the method.
|
DeprecatedOngoingStubbing<T> |
DeprecatedOngoingStubbing.toAnswer(Answer<?> answer)
Set a generic Answer for the stubbed method.
|
VoidMethodStubbable<T> |
VoidMethodStubbable.toAnswer(Answer<?> answer)
Stubs a void method with generic
Answer |