Package org.mockito.internal.stubbing
Class StubbedInvocationMatcher
java.lang.Object
org.mockito.internal.invocation.InvocationMatcher
org.mockito.internal.stubbing.StubbedInvocationMatcher
- All Implemented Interfaces:
Serializable,DescribedInvocation,MatchableInvocation,Answer,Stubbing
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionStubbedInvocationMatcher(Answer answer, MatchableInvocation invocation, Strictness strictness) -
Method Summary
Modifier and TypeMethodDescriptionvoidanswer(InvocationOnMock invocation) Informs about theStrictnesslevel of this stubbing.voidmarkStubUsed(DescribedInvocation usedAt) toString()Describes the invocation in the human friendly way.booleanwasUsed()Informs if the stubbing was usedMethods inherited from class org.mockito.internal.invocation.InvocationMatcher
captureArgumentsFrom, createFrom, getInvocation, getLocation, getMatchers, getMethod, hasSameMethod, hasSimilarMethod, matchesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.mockito.stubbing.Stubbing
getInvocation
-
Constructor Details
-
StubbedInvocationMatcher
public StubbedInvocationMatcher(Answer answer, MatchableInvocation invocation, Strictness strictness)
-
-
Method Details
-
answer
-
addAnswer
-
markStubUsed
-
wasUsed
public boolean wasUsed()Description copied from interface:StubbingInforms if the stubbing was usedWhat does it mean 'used stubbing'? Stubbing like
when(mock.foo()).thenReturn(true)is considered used when the methodmock.foo()is actually invoked during the execution of code under test.This method is used internally by Mockito to report and detect unused stubbings. Unused stubbings are dead code and should be deleted to increase clarity of tests (see
MockitoHint.To understand how this method is useful, see the description at
MockingDetails.getStubbings(). -
toString
Description copied from interface:DescribedInvocationDescribes the invocation in the human friendly way.- Specified by:
toStringin interfaceDescribedInvocation- Overrides:
toStringin classInvocationMatcher- Returns:
- the description of this invocation.
-
getStrictness
Description copied from interface:StubbingInforms about theStrictnesslevel of this stubbing. For more information about setting strictness for stubbings seeMockito.lenient().- Specified by:
getStrictnessin interfaceStubbing
-