public class StubbedInvocationMatcher extends InvocationMatcher implements Serializable, Stubbing
Constructor and Description |
---|
StubbedInvocationMatcher(Answer answer,
MatchableInvocation invocation,
Strictness strictness) |
Modifier and Type | Method and Description |
---|---|
void |
addAnswer(Answer answer) |
Object |
answer(InvocationOnMock invocation) |
Strictness |
getStrictness()
Informs about the
Strictness level of this stubbing. |
void |
markStubUsed(DescribedInvocation usedAt) |
String |
toString()
Describes the invocation in the human friendly way.
|
boolean |
wasUsed()
Informs if the stubbing was used
|
captureArgumentsFrom, createFrom, getInvocation, getLocation, getMatchers, getMethod, hasSameMethod, hasSimilarMethod, matches
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getInvocation
public StubbedInvocationMatcher(Answer answer, MatchableInvocation invocation, Strictness strictness)
public Object answer(InvocationOnMock invocation) throws Throwable
public void addAnswer(Answer answer)
public void markStubUsed(DescribedInvocation usedAt)
public boolean wasUsed()
Stubbing
What does it mean 'used stubbing'?
Stubbing like when(mock.foo()).thenReturn(true)
is considered used
when the method mock.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()
.
public String toString()
DescribedInvocation
toString
in interface DescribedInvocation
toString
in class InvocationMatcher
public Strictness getStrictness()
Stubbing
Strictness
level of this stubbing.
For more information about setting strictness for stubbings see Mockito.lenient()
.getStrictness
in interface Stubbing
Copyright © 2023. All rights reserved.