Uses of Interface
org.mockito.stubbing.Answer
-
Packages that use Answer Package Description org.mockito Mockito is a mock library for java - seeMockitoclass for usage.org.mockito.configuration Mockito configuration utilities.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 default Answers.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 classAnswersEnumeration of pre-configured mock answersFields in org.mockito declared as Answer Modifier and Type Field Description static Answer<java.lang.Object>Mockito. CALLS_REAL_METHODSOptionalAnswerto be used withMockito.mock(Class, Answer)private Answer<java.lang.Object>Answers. implementationstatic Answer<java.lang.Object>Mockito. RETURNS_DEEP_STUBSOptionalAnswerto be used withMockito.mock(Class, Answer).static Answer<java.lang.Object>Mockito. RETURNS_DEFAULTSThe defaultAnswerof every mock if the mock was not stubbed.static Answer<java.lang.Object>Mockito. RETURNS_MOCKSOptionalAnswerto be used withMockito.mock(Class, Answer)static Answer<java.lang.Object>Mockito. RETURNS_SELFOptionalAnswerto be used withMockito.mock(Class, Answer).static Answer<java.lang.Object>Mockito. RETURNS_SMART_NULLSOptionalAnswerto 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<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 8static <T> Answer<T>AdditionalAnswers. delegatesTo(java.lang.Object delegate)An answer that directly forwards the calls to the delegate.Answer<java.lang.Object>Answers. get()Deprecated.as of 2.1.0 Use the enum-constant directly, instead of this getter.static <T> Answer<T>AdditionalAnswers. returnsArgAt(int position)Returns the parameter of an invocation at the given position.static <T> Answer<T>AdditionalAnswers. returnsElementsOf(java.util.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.MockSettingsMockSettings. defaultAnswer(Answer defaultAnswer)Specifies default answers to interactions.static StubberMockito. doAnswer(Answer answer)UsedoAnswer()when you want to stub a void method with genericAnswer.static <T> TMockito. mock(java.lang.Class<T> classToMock, Answer defaultAnswer)Creates mock with a specified strategy for its answers to interactions.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 <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.BDDMockito.BDDMyOngoingStubbing<T>BDDMockito.BDDMyOngoingStubbing. will(Answer<?> answer)See originalOngoingStubbing.then(Answer)BDDMockito.BDDMyOngoingStubbing<T>BDDMockito.BDDOngoingStubbingImpl. will(Answer<?> answer)BDDMockito.BDDStubberBDDMockito.BDDStubber. will(Answer<?> answer)See originalBaseStubber.doAnswer(Answer)BDDMockito.BDDStubberBDDMockito.BDDStubberImpl. will(Answer<?> answer)static BDDMockito.BDDStubberBDDMockito. will(Answer<?> answer)see originalMockito.doAnswer(Answer)BDDMockito.BDDMyOngoingStubbing<T>BDDMockito.BDDMyOngoingStubbing. willAnswer(Answer<?> answer)See originalOngoingStubbing.thenAnswer(Answer)BDDMockito.BDDMyOngoingStubbing<T>BDDMockito.BDDOngoingStubbingImpl. willAnswer(Answer<?> answer)BDDMockito.BDDStubberBDDMockito.BDDStubber. willAnswer(Answer<?> answer)See originalBaseStubber.doAnswer(Answer)BDDMockito.BDDStubberBDDMockito.BDDStubberImpl. willAnswer(Answer<?> answer)static BDDMockito.BDDStubberBDDMockito. willAnswer(Answer<?> answer)see originalMockito.doAnswer(Answer)Constructors in org.mockito with parameters of type Answer Constructor Description Answers(Answer<java.lang.Object> implementation) -
Uses of Answer in org.mockito.configuration
Methods in org.mockito.configuration that return Answer Modifier and Type Method Description Answer<java.lang.Object>DefaultMockitoConfiguration. getDefaultAnswer()Answer<java.lang.Object>IMockitoConfiguration. getDefaultAnswer()Allows configuring the default answers of unstubbed invocations -
Uses of Answer in org.mockito.internal.configuration
Methods in org.mockito.internal.configuration that return Answer Modifier and Type Method Description Answer<java.lang.Object>GlobalConfiguration. getDefaultAnswer() -
Uses of Answer in org.mockito.internal.creation
Methods in org.mockito.internal.creation that return Answer Modifier and Type Method Description Answer<java.lang.Object>MockSettingsImpl. getDefaultAnswer()Methods in org.mockito.internal.creation with parameters of type Answer Modifier and Type Method Description MockSettingsMockSettingsImpl. defaultAnswer(Answer defaultAnswer) -
Uses of Answer in org.mockito.internal.creation.settings
Fields in org.mockito.internal.creation.settings declared as Answer Modifier and Type Field Description protected Answer<java.lang.Object>CreationSettings. defaultAnswerMethods in org.mockito.internal.creation.settings that return Answer Modifier and Type Method Description Answer<java.lang.Object>CreationSettings. getDefaultAnswer() -
Uses of Answer in org.mockito.internal.stubbing
Classes in org.mockito.internal.stubbing that implement Answer Modifier and Type Class Description classStubbedInvocationMatcherFields in org.mockito.internal.stubbing with type parameters of type Answer Modifier and Type Field Description private java.util.List<Answer<?>>DoAnswerStyleStubbing. answersprivate java.util.Queue<Answer>StubbedInvocationMatcher. answersprivate java.util.List<Answer<?>>StubberImpl. answersMethods in org.mockito.internal.stubbing that return types with arguments of type Answer Modifier and Type Method Description (package private) java.util.List<Answer<?>>DoAnswerStyleStubbing. getAnswers()Methods in org.mockito.internal.stubbing with parameters of type Answer Modifier and Type Method Description StubbedInvocationMatcherInvocationContainerImpl. addAnswer(Answer answer, boolean isConsecutive, Strictness stubbingStrictness)Adds new stubbed answer and returns the invocation matcher the answer was added to.voidInvocationContainerImpl. addAnswer(Answer answer, Strictness stubbingStrictness)voidStubbedInvocationMatcher. addAnswer(Answer answer)voidInvocationContainerImpl. addConsecutiveAnswer(Answer answer)StubberDefaultLenientStubber. doAnswer(Answer answer)StubberStubberImpl. doAnswer(Answer answer)OngoingStubbing<T>BaseStubbing. then(Answer<?> answer)OngoingStubbing<T>ConsecutiveStubbing. thenAnswer(Answer<?> answer)OngoingStubbing<T>OngoingStubbingImpl. thenAnswer(Answer<?> answer)Method parameters in org.mockito.internal.stubbing with type arguments of type Answer Modifier and Type Method Description (package private) voidDoAnswerStyleStubbing. setAnswers(java.util.List<Answer<?>> answers, Strictness stubbingStrictness)voidInvocationContainerImpl. setAnswersForStubbing(java.util.List<Answer<?>> answers, Strictness strictness)Sets the answers declared with 'doAnswer' style.Constructors in org.mockito.internal.stubbing with parameters of type Answer Constructor Description StubbedInvocationMatcher(Answer answer, MatchableInvocation invocation, Strictness strictness) -
Uses of Answer in org.mockito.internal.stubbing.answers
Classes in org.mockito.internal.stubbing.answers that implement Answer Modifier and Type Class Description classAbstractThrowsExceptionclassAnswersWithDelayReturns as the provided answer would return, after delaying the specified amount.classCallsRealMethodsOptional Answer that adds partial mocking supportclassClonesArgumentsclassDoesNothingclassReturnsclassReturnsArgumentAtReturns the passed parameter identity at specified index.classReturnsElementsOfReturns elements of the collection.classThrowsExceptionAn answer that always throws the same throwable.classThrowsExceptionForClassTypeFields in org.mockito.internal.stubbing.answers declared as Answer Modifier and Type Field Description private Answer<java.lang.Object>AnswersWithDelay. answerMethods in org.mockito.internal.stubbing.answers that return Answer Modifier and Type Method Description static <T,A>
Answer<T>AnswerFunctionalInterfaces. toAnswer(Answer1<T,A> answer)Construct an answer from a two parameter answer interfacestatic <T,A,B>
Answer<T>AnswerFunctionalInterfaces. toAnswer(Answer2<T,A,B> answer)Construct an answer from a two parameter answer interfacestatic <T,A,B,C>
Answer<T>AnswerFunctionalInterfaces. toAnswer(Answer3<T,A,B,C> answer)Construct an answer from a three parameter answer interfacestatic <T,A,B,C,D>
Answer<T>AnswerFunctionalInterfaces. toAnswer(Answer4<T,A,B,C,D> answer)Construct an answer from a four parameter answer interfacestatic <T,A,B,C,D,E>
Answer<T>AnswerFunctionalInterfaces. toAnswer(Answer5<T,A,B,C,D,E> answer)Construct an answer from a five parameter answer interfacestatic <T,A,B,C,D,E,F>
Answer<T>AnswerFunctionalInterfaces. toAnswer(Answer6<T,A,B,C,D,E,F> answer)Construct an answer from a six parameter answer interfacestatic <A> Answer<java.lang.Void>AnswerFunctionalInterfaces. toAnswer(VoidAnswer1<A> answer)Construct an answer from a two parameter answer interfacestatic <A,B>
Answer<java.lang.Void>AnswerFunctionalInterfaces. toAnswer(VoidAnswer2<A,B> answer)Construct an answer from a two parameter answer interfacestatic <A,B,C>
Answer<java.lang.Void>AnswerFunctionalInterfaces. toAnswer(VoidAnswer3<A,B,C> answer)Construct an answer from a three parameter answer interfacestatic <A,B,C,D>
Answer<java.lang.Void>AnswerFunctionalInterfaces. toAnswer(VoidAnswer4<A,B,C,D> answer)Construct an answer from a four parameter answer interfacestatic <A,B,C,D,E>
Answer<java.lang.Void>AnswerFunctionalInterfaces. toAnswer(VoidAnswer5<A,B,C,D,E> answer)Construct an answer from a five parameter answer interfacestatic <A,B,C,D,E,F>
Answer<java.lang.Void>AnswerFunctionalInterfaces. toAnswer(VoidAnswer6<A,B,C,D,E,F> answer)Construct an answer from a five parameter answer interfaceConstructors in org.mockito.internal.stubbing.answers with parameters of type Answer Constructor Description AnswersWithDelay(long sleepyTime, Answer<java.lang.Object> answer) -
Uses of Answer in org.mockito.internal.stubbing.defaultanswers
Classes in org.mockito.internal.stubbing.defaultanswers that implement Answer Modifier and Type Class Description classForwardsInvocationsInternal answer to forward invocations on a real instance.classGloballyConfiguredAnswerGlobally configured Answer.classReturnsDeepStubsReturning deep stub implementation.private static classReturnsDeepStubs.DeeplyStubbedAnswerprivate static classReturnsDeepStubs.ReturnsDeepStubsSerializationFallbackclassReturnsEmptyValuesDefault answer of every Mockito mock.classReturnsMocksclassReturnsMoreEmptyValuesIt's likely this implementation will be used by default by every Mockito 4.0.0 mock.classReturnsSmartNullsOptional Answer that can be used withMockito.mock(Class, Answer)private static classReturnsSmartNulls.ThrowsSmartNullPointerclassTriesToReturnSelfFields in org.mockito.internal.stubbing.defaultanswers declared as Answer Modifier and Type Field Description private Answer<java.lang.Object>ReturnsMocks. delegateprivate Answer<java.lang.Object>ReturnsMoreEmptyValues. delegateprivate Answer<java.lang.Object>ReturnsSmartNulls. delegate -
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 interfaceStubbingStubbing declared on the mock object.Methods in org.mockito.stubbing with parameters of type Answer Modifier and Type Method Description StubberBaseStubber. 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.
-