Uses of Interface
org.mockito.stubbing.Answer
-
Packages that use Answer Package Description org.mockito Mockito is a mock library for java - seeMockito
class for usage.org.mockito.configuration Mockito configuration utilities.org.mockito.mock Mock settings related classes.org.mockito.stubbing Stubbing related classes. -
-
Uses of Answer in org.mockito
Classes in org.mockito that implement Answer Modifier and Type Class Description class
Answers
Enumeration of pre-configured mock answersFields in org.mockito declared as Answer Modifier and Type Field Description static Answer<Object>
Mockito. CALLS_REAL_METHODS
OptionalAnswer
to be used withMockito.mock(Class, Answer)
static Answer<Object>
Mockito. RETURNS_DEEP_STUBS
OptionalAnswer
to be used withMockito.mock(Class, Answer)
.static Answer<Object>
Mockito. RETURNS_DEFAULTS
The defaultAnswer
of every mock if the mock was not stubbed.static Answer<Object>
Mockito. RETURNS_MOCKS
OptionalAnswer
to be used withMockito.mock(Class, Answer)
static Answer<Object>
Mockito. RETURNS_SELF
OptionalAnswer
to be used withMockito.mock(Class, Answer)
.static Answer<Object>
Mockito. RETURNS_SMART_NULLS
OptionalAnswer
to be used withMockito.mock(Class, Answer)
.Methods in org.mockito that return Answer Modifier and Type Method Description 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<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<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<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<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<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<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 8static <T> Answer<T>
AdditionalAnswers. delegatesTo(Object delegate)
An answer that directly forwards the calls to the delegate.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 Answer Modifier and Type Method Description static <T> Answer<T>
AdditionalAnswers. answersWithDelay(long sleepyTime, Answer<T> answer)
Returns an answer after a delay with a defined length.MockSettings
MockSettings. defaultAnswer(Answer defaultAnswer)
Specifies default answers to interactions.static Stubber
Mockito. doAnswer(Answer answer)
UsedoAnswer()
when you want to stub a void method with genericAnswer
.static <T> T
Mockito. mock(Class<T> classToMock, Answer defaultAnswer)
Creates mock with a specified strategy for its answers to interactions.static <T> T
Mockito. mock(Answer defaultAnswer, T... reified)
Creates a mock object of the requested class or interface with the given default answer.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 <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.BDDMockito.BDDMyOngoingStubbing<T>
BDDMockito.BDDMyOngoingStubbing. will(Answer<?> answer)
See originalOngoingStubbing.then(Answer)
BDDMockito.BDDStubber
BDDMockito.BDDStubber. will(Answer<?> answer)
See originalBaseStubber.doAnswer(Answer)
static BDDMockito.BDDStubber
BDDMockito. will(Answer<?> answer)
see originalMockito.doAnswer(Answer)
BDDMockito.BDDMyOngoingStubbing<T>
BDDMockito.BDDMyOngoingStubbing. willAnswer(Answer<?> answer)
See originalOngoingStubbing.thenAnswer(Answer)
BDDMockito.BDDStubber
BDDMockito.BDDStubber. willAnswer(Answer<?> answer)
See originalBaseStubber.doAnswer(Answer)
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 Answer Modifier and Type Method Description Answer<Object>
DefaultMockitoConfiguration. getDefaultAnswer()
Answer<Object>
IMockitoConfiguration. getDefaultAnswer()
Allows configuring the default answers of un-stubbed invocations -
Uses of Answer in org.mockito.mock
Methods in org.mockito.mock that return Answer Modifier and Type Method Description Answer<?>
MockCreationSettings. getDefaultAnswer()
the default answer for this mock, seeMockSettings.defaultAnswer(org.mockito.stubbing.Answer)
. -
Uses of Answer in org.mockito.stubbing
Subinterfaces of Answer in org.mockito.stubbing Modifier and Type Interface Description interface
Stubbing
Stubbing declared on the mock object.Methods in org.mockito.stubbing with parameters of type Answer Modifier and Type Method Description Stubber
BaseStubber. doAnswer(Answer answer)
Use it for stubbing consecutive calls inMockito.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.
-