Package org.mockito.internal.stubbing
Class InvocationContainerImpl
- java.lang.Object
-
- org.mockito.internal.stubbing.InvocationContainerImpl
-
- All Implemented Interfaces:
java.io.Serializable,InvocationContainer
public class InvocationContainerImpl extends java.lang.Object implements InvocationContainer, java.io.Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private DoAnswerStyleStubbingdoAnswerStyleStubbingprivate MatchableInvocationinvocationForStubbingprivate StrictnessmockStrictnessprivate RegisteredInvocationsregisteredInvocationsprivate static longserialVersionUIDprivate java.util.LinkedList<StubbedInvocationMatcher>stubbed
-
Constructor Summary
Constructors Constructor Description InvocationContainerImpl(MockCreationSettings mockSettings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StubbedInvocationMatcheraddAnswer(Answer answer, boolean isConsecutive, Strictness stubbingStrictness)Adds new stubbed answer and returns the invocation matcher the answer was added to.voidaddAnswer(Answer answer, Strictness stubbingStrictness)voidaddConsecutiveAnswer(Answer answer)(package private) java.lang.ObjectanswerTo(Invocation invocation)voidclearInvocations()private RegisteredInvocationscreateRegisteredInvocations(MockCreationSettings mockSettings)StubbedInvocationMatcherfindAnswerFor(Invocation invocation)MatchableInvocationgetInvocationForStubbing()java.util.List<Invocation>getInvocations()java.util.Collection<Stubbing>getStubbingsAscending()Stubbings in ascending order, most recent lastjava.util.List<Stubbing>getStubbingsDescending()Stubbings in descending order, most recent firstbooleanhasAnswersForStubbing()booleanhasInvocationForPotentialStubbing()java.lang.ObjectinvokedMock()voidresetInvocationForPotentialStubbing(MatchableInvocation invocationMatcher)voidsetAnswersForStubbing(java.util.List<Answer<?>> answers, Strictness strictness)Sets the answers declared with 'doAnswer' style.voidsetInvocationForPotentialStubbing(MatchableInvocation invocation)voidsetMethodForStubbing(MatchableInvocation invocation)java.lang.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
stubbed
private final java.util.LinkedList<StubbedInvocationMatcher> stubbed
-
doAnswerStyleStubbing
private final DoAnswerStyleStubbing doAnswerStyleStubbing
-
registeredInvocations
private final RegisteredInvocations registeredInvocations
-
mockStrictness
private final Strictness mockStrictness
-
invocationForStubbing
private MatchableInvocation invocationForStubbing
-
-
Constructor Detail
-
InvocationContainerImpl
public InvocationContainerImpl(MockCreationSettings mockSettings)
-
-
Method Detail
-
setInvocationForPotentialStubbing
public void setInvocationForPotentialStubbing(MatchableInvocation invocation)
-
resetInvocationForPotentialStubbing
public void resetInvocationForPotentialStubbing(MatchableInvocation invocationMatcher)
-
addAnswer
public void addAnswer(Answer answer, Strictness stubbingStrictness)
-
addConsecutiveAnswer
public void addConsecutiveAnswer(Answer answer)
-
addAnswer
public StubbedInvocationMatcher addAnswer(Answer answer, boolean isConsecutive, Strictness stubbingStrictness)
Adds new stubbed answer and returns the invocation matcher the answer was added to.
-
answerTo
java.lang.Object answerTo(Invocation invocation) throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
findAnswerFor
public StubbedInvocationMatcher findAnswerFor(Invocation invocation)
-
setAnswersForStubbing
public void setAnswersForStubbing(java.util.List<Answer<?>> answers, Strictness strictness)
Sets the answers declared with 'doAnswer' style.
-
hasAnswersForStubbing
public boolean hasAnswersForStubbing()
-
hasInvocationForPotentialStubbing
public boolean hasInvocationForPotentialStubbing()
-
setMethodForStubbing
public void setMethodForStubbing(MatchableInvocation invocation)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getInvocations
public java.util.List<Invocation> getInvocations()
-
clearInvocations
public void clearInvocations()
-
getStubbingsDescending
public java.util.List<Stubbing> getStubbingsDescending()
Stubbings in descending order, most recent first
-
getStubbingsAscending
public java.util.Collection<Stubbing> getStubbingsAscending()
Stubbings in ascending order, most recent last
-
invokedMock
public java.lang.Object invokedMock()
-
getInvocationForStubbing
public MatchableInvocation getInvocationForStubbing()
-
createRegisteredInvocations
private RegisteredInvocations createRegisteredInvocations(MockCreationSettings mockSettings)
-
-