Uses of Interface
org.mockito.stubbing.Answer
Packages that use Answer
Package
Description
Mockito is a mock library for java - see Mockito class for for usage.
Mockito configuration utilities
Internal classes, not to be used by clients.
Mockito configuration
Mock object creation.
Stubbing logic.
Answers for stubbed calls
Implementations of ReturnValues
External stubbing related classes
-
Uses of Answer in org.mockito
Fields in org.mockito declared as AnswerModifier and TypeFieldDescriptionMockito.CALLS_REAL_METHODS
OptionalAnswer
to be used withMockito.mock(Class, Answer)
Mockito.RETURNS_DEEP_STUBS
OptionalAnswer
to be used withMockito.mock(Class, Answer)
.Mockito.RETURNS_DEFAULTS
The defaultAnswer
of every mock if the mock was not stubbed.Mockito.RETURNS_MOCKS
OptionalAnswer
to be used withMockito.mock(Class, Answer)
Mockito.RETURNS_SMART_NULLS
OptionalAnswer
to be used withMockito.mock(Class, Answer)
.Methods in org.mockito that return AnswerModifier and TypeMethodDescriptionstatic <T> Answer<T>
AdditionalAnswers.delegatesTo
(Object delegate) An answer that directly forwards the calls to the delegate.Answers.get()
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.Methods in org.mockito with parameters of type AnswerModifier and TypeMethodDescriptionMockSettings.defaultAnswer
(Answer defaultAnswer) Specifies default answers to interactions.static Stubber
UsedoAnswer()
when you want to stub a void method with genericAnswer
.static <T> T
Creates mock with a specified strategy for its answers to interactions.See originalOngoingStubbing.then(Answer)
Deprecated.BDDMockito.BDDMyOngoingStubbing.willAnswer
(Answer<?> answer) See originalOngoingStubbing.thenAnswer(Answer)
BDDMockito.BDDOngoingStubbingImpl.willAnswer
(Answer<?> answer) Deprecated.BDDMockito.BDDStubber.willAnswer
(Answer answer) See originalStubber.doAnswer(Answer)
BDDMockito.BDDStubberImpl.willAnswer
(Answer answer) Deprecated.static BDDMockito.BDDStubber
BDDMockito.willAnswer
(Answer answer) see originalMockito.doAnswer(Answer)
-
Uses of Answer in org.mockito.configuration
Methods in org.mockito.configuration that return AnswerModifier and TypeMethodDescriptionDefaultMockitoConfiguration.getDefaultAnswer()
IMockitoConfiguration.getDefaultAnswer()
Allows configuring the default answers of unstubbed invocations -
Uses of Answer in org.mockito.internal
Methods in org.mockito.internal with parameters of type AnswerMethod parameters in org.mockito.internal with type arguments of type AnswerModifier and TypeMethodDescriptionvoid
InternalMockHandler.setAnswersForStubbing
(List<Answer> answers) -
Uses of Answer in org.mockito.internal.configuration
Methods in org.mockito.internal.configuration that return Answer -
Uses of Answer in org.mockito.internal.creation
Methods in org.mockito.internal.creation that return AnswerMethods in org.mockito.internal.creation with parameters of type Answer -
Uses of Answer in org.mockito.internal.creation.settings
Fields in org.mockito.internal.creation.settings declared as AnswerMethods in org.mockito.internal.creation.settings that return Answer -
Uses of Answer in org.mockito.internal.stubbing
Classes in org.mockito.internal.stubbing that implement AnswerMethods in org.mockito.internal.stubbing with parameters of type AnswerModifier and TypeMethodDescriptionvoid
void
void
void
InvocationContainerImpl.addAnswerForVoidMethod
(Answer answer) void
InvocationContainerImpl.addConsecutiveAnswer
(Answer answer) ConsecutiveStubbing.thenAnswer
(Answer<?> answer) OngoingStubbingImpl.thenAnswer
(Answer<?> answer) Method parameters in org.mockito.internal.stubbing with type arguments of type AnswerModifier and TypeMethodDescriptionvoid
InvocationContainerImpl.setAnswersForStubbing
(List<Answer> answers) Constructors in org.mockito.internal.stubbing with parameters of type AnswerModifierConstructorDescriptionStubbedInvocationMatcher
(InvocationMatcher invocation, Answer answer) -
Uses of Answer in org.mockito.internal.stubbing.answers
Classes in org.mockito.internal.stubbing.answers that implement AnswerModifier and TypeClassDescriptionclass
class
Optional Answer that adds partial mocking supportclass
class
class
class
Returns the passed parameter identity at specified index.class
Returns elements of the collection.class
class
Methods in org.mockito.internal.stubbing.answers with parameters of type AnswerModifier and TypeMethodDescriptionvoid
AnswersValidator.validate
(Answer<?> answer, Invocation invocation) -
Uses of Answer in org.mockito.internal.stubbing.defaultanswers
Classes in org.mockito.internal.stubbing.defaultanswers that implement AnswerModifier and TypeClassDescriptionclass
Internal answer to forward invocations on a real instance.class
Globally configured Answer.class
Returning deep stub implementation.class
Default answer of every Mockito mock.class
class
It's likely this implementation will be used by default by every Mockito 2.0 mock.class
Optional Answer that can be used withMockito.mock(Class, Answer)
Methods in org.mockito.internal.stubbing.defaultanswers that return Answer -
Uses of Answer in org.mockito.mock
Methods in org.mockito.mock that return AnswerModifier and TypeMethodDescriptionMockCreationSettings.getDefaultAnswer()
the default answer for this mock, seeMockSettings.defaultAnswer(org.mockito.stubbing.Answer)
. -
Uses of Answer in org.mockito.stubbing
Methods in org.mockito.stubbing with parameters of type AnswerModifier and TypeMethodDescriptionUse it for stubbing consecutive calls inMockito.doAnswer(Answer)
style:Sets a generic Answer for the method.OngoingStubbing.thenAnswer
(Answer<?> answer) Sets a generic Answer for the method.Set a generic Answer for the stubbed method.Stubs a void method with genericAnswer
-
Uses of Answer in org.mockito.stubbing.answers
Classes in org.mockito.stubbing.answers that implement Answer
AdditionalAnswers.returnsElementsOf(java.util.Collection<?>)