Package | Description |
---|---|
org.mockito |
Mockito is a mock library for java - see
Mockito class for usage. |
org.mockito.internal |
Internal classes, not to be used by clients.
|
org.mockito.internal.debugging |
Whatever helps in debugging failed tests.
|
org.mockito.internal.exceptions | |
org.mockito.internal.handler | |
org.mockito.internal.invocation |
Invocation machinery and related classes.
|
org.mockito.internal.invocation.finder | |
org.mockito.internal.junit |
JUnit integration support classes.
|
org.mockito.internal.listeners | |
org.mockito.internal.reporting |
Deals with nicely printing verification errors.
|
org.mockito.internal.stubbing |
Stubbing logic.
|
org.mockito.internal.stubbing.answers |
Answers for stubbed calls.
|
org.mockito.internal.util |
Static utils
|
org.mockito.internal.verification |
Verification logic.
|
org.mockito.internal.verification.api |
This package should be open to public once verification API is fully finished.
|
org.mockito.internal.verification.checkers |
Verification checkers.
|
org.mockito.invocation |
Public API related to mock method invocations.
|
org.mockito.stubbing |
Stubbing related classes.
|
Modifier and Type | Method and Description |
---|---|
java.util.Collection<Invocation> |
MockingDetails.getInvocations()
All method invocations on this mock.
|
Modifier and Type | Method and Description |
---|---|
Invocation |
MockitoCore.getLastInvocation()
For testing purposes only.
|
Modifier and Type | Method and Description |
---|---|
boolean |
InOrderImpl.isVerified(Invocation i) |
void |
InOrderImpl.markVerified(Invocation i) |
Modifier and Type | Field and Description |
---|---|
private java.util.List<Invocation> |
WarningsFinder.baseUnusedStubs |
Modifier and Type | Method and Description |
---|---|
void |
LoggingListener.foundStubCalledWithDifferentArgs(Invocation unused,
InvocationMatcher unstubbed) |
void |
FindingsListener.foundStubCalledWithDifferentArgs(Invocation unused,
InvocationMatcher unstubbed) |
void |
LoggingListener.foundUnusedStub(Invocation unused) |
void |
FindingsListener.foundUnusedStub(Invocation unused) |
Constructor and Description |
---|
WarningsFinder(java.util.List<Invocation> unusedStubs,
java.util.List<InvocationMatcher> allInvocations) |
WarningsPrinterImpl(java.util.List<Invocation> unusedStubs,
java.util.List<InvocationMatcher> allInvocations,
boolean warnAboutUnstubbed) |
Modifier and Type | Method and Description |
---|---|
static MockitoAssertionError |
Reporter.noMoreInteractionsWanted(Invocation undesired,
java.util.List<VerificationAwareInvocation> invocations) |
static MockitoAssertionError |
Reporter.noMoreInteractionsWantedInOrder(Invocation undesired) |
static void |
Reporter.potentialStubbingProblem(Invocation actualInvocation,
java.util.Collection<Invocation> argMismatchStubbings) |
Modifier and Type | Method and Description |
---|---|
static UnnecessaryStubbingException |
Reporter.formatUnncessaryStubbingException(java.lang.Class<?> testClass,
java.util.Collection<Invocation> unnecessaryStubbings) |
static void |
Reporter.potentialStubbingProblem(Invocation actualInvocation,
java.util.Collection<Invocation> argMismatchStubbings) |
static void |
Reporter.unncessaryStubbingException(java.util.List<Invocation> unused) |
Modifier and Type | Field and Description |
---|---|
private Invocation |
NotifiedMethodInvocationReport.invocation |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
NullResultGuardian.handle(Invocation invocation) |
java.lang.Object |
MockHandlerImpl.handle(Invocation invocation) |
java.lang.Object |
InvocationNotifierHandler.handle(Invocation invocation) |
private void |
InvocationNotifierHandler.notifyMethodCall(Invocation invocation,
java.lang.Object returnValue) |
private void |
InvocationNotifierHandler.notifyMethodCallException(Invocation invocation,
java.lang.Throwable exception) |
Constructor and Description |
---|
NotifiedMethodInvocationReport(Invocation invocation,
java.lang.Object returnedValue)
Build a new
MethodInvocationReport with a return value. |
NotifiedMethodInvocationReport(Invocation invocation,
java.lang.Throwable throwable)
Build a new
MethodInvocationReport with a return value. |
Modifier and Type | Class and Description |
---|---|
class |
InterceptedInvocation |
Modifier and Type | Field and Description |
---|---|
private Invocation |
InvocationMatcher.invocation |
private Invocation |
MatcherApplicationStrategy.invocation |
Modifier and Type | Method and Description |
---|---|
Invocation |
DefaultInvocationFactory.createInvocation(java.lang.Object target,
MockCreationSettings settings,
java.lang.reflect.Method method,
java.util.concurrent.Callable realMethod,
java.lang.Object... args) |
Invocation |
DefaultInvocationFactory.createInvocation(java.lang.Object target,
MockCreationSettings settings,
java.lang.reflect.Method method,
InvocationFactory.RealMethodBehavior realMethod,
java.lang.Object... args) |
private Invocation |
DefaultInvocationFactory.createInvocation(java.lang.Object target,
MockCreationSettings settings,
java.lang.reflect.Method method,
RealMethod superMethod,
java.lang.Object[] args) |
static Invocation |
InvocationsFinder.findFirstMatchingUnverifiedInvocation(java.util.List<Invocation> invocations,
MatchableInvocation wanted,
InOrderContext context) |
static Invocation |
InvocationsFinder.findFirstUnverified(java.util.List<Invocation> invocations) |
(package private) static Invocation |
InvocationsFinder.findFirstUnverified(java.util.List<Invocation> invocations,
java.lang.Object mock) |
static Invocation |
InvocationsFinder.findFirstUnverifiedInOrder(InOrderContext context,
java.util.List<Invocation> orderedInvocations)
i3 is unverified here:
i1, i2, i3
v
all good here:
i1, i2, i3
v v
|
static Invocation |
InvocationsFinder.findPreviousVerifiedInOrder(java.util.List<Invocation> invocations,
InOrderContext context) |
static Invocation |
InvocationsFinder.findSimilarInvocation(java.util.List<Invocation> invocations,
MatchableInvocation wanted) |
Invocation |
InvocationMatcher.getInvocation() |
Modifier and Type | Method and Description |
---|---|
java.util.List<Invocation> |
UnusedStubsFinder.find(java.util.List<?> mocks)
Deprecated.
Finds all unused stubs for given mocks
|
static java.util.List<Invocation> |
InvocationsFinder.findAllMatchingUnverifiedChunks(java.util.List<Invocation> invocations,
MatchableInvocation wanted,
InOrderContext orderingContext) |
static java.util.List<Invocation> |
InvocationsFinder.findInvocations(java.util.List<Invocation> invocations,
MatchableInvocation wanted) |
static java.util.List<Invocation> |
InvocationsFinder.findMatchingChunk(java.util.List<Invocation> invocations,
MatchableInvocation wanted,
int wantedCount,
InOrderContext context)
some examples how it works:
Given invocations sequence:
1,1,2,1
if wanted is 1 and mode is times(2) then returns
1,1
if wanted is 1 and mode is atLeast() then returns
1,1,1
if wanted is 1 and mode is times(x), where x != 2 then returns
1,1,1
|
private static java.util.List<Invocation> |
InvocationsFinder.getFirstMatchingChunk(MatchableInvocation wanted,
java.util.List<Invocation> unverified) |
private static java.util.List<Invocation> |
InvocationsFinder.removeVerifiedInOrder(java.util.List<Invocation> invocations,
InOrderContext orderingContext) |
Modifier and Type | Method and Description |
---|---|
private boolean |
InvocationMatcher.argumentsMatch(Invocation actual) |
InvocationMatcher |
MatchersBinder.bindMatchers(ArgumentMatcherStorage argumentMatcherStorage,
Invocation invocation) |
void |
InvocationMatcher.captureArgumentsFrom(Invocation invocation) |
int |
InvocationComparator.compare(Invocation o1,
Invocation o2) |
static MatcherApplicationStrategy |
MatcherApplicationStrategy.getMatcherApplicationStrategyFor(Invocation invocation,
java.util.List<ArgumentMatcher<?>> matchers)
Returns the
MatcherApplicationStrategy that must be used to capture the
arguments of the given invocation using the given matchers. |
private static MatcherApplicationStrategy.MatcherApplicationType |
MatcherApplicationStrategy.getMatcherApplicationType(Invocation invocation,
java.util.List<ArgumentMatcher<?>> matchers) |
boolean |
InvocationMatcher.hasSameMethod(Invocation candidate) |
boolean |
InvocationMatcher.hasSimilarMethod(Invocation candidate)
similar means the same method name, same mock, unverified and: if arguments are the same cannot be overloaded
|
boolean |
InvocationsFinder.RemoveNotMatching.isOut(Invocation invocation) |
boolean |
InvocationsFinder.RemoveUnverifiedInOrder.isOut(Invocation invocation) |
static void |
InvocationMarker.markVerified(Invocation invocation,
MatchableInvocation wanted) |
boolean |
InvocationMatcher.matches(Invocation candidate) |
private void |
MatchersBinder.validateMatchers(Invocation invocation,
java.util.List<LocalizedMatcher> lastMatchers) |
private static int |
MatcherApplicationStrategy.varargLength(Invocation invocation) |
Modifier and Type | Method and Description |
---|---|
static java.util.List<InvocationMatcher> |
InvocationMatcher.createFrom(java.util.List<Invocation> invocations) |
static java.util.List<Invocation> |
InvocationsFinder.findAllMatchingUnverifiedChunks(java.util.List<Invocation> invocations,
MatchableInvocation wanted,
InOrderContext orderingContext) |
static Invocation |
InvocationsFinder.findFirstMatchingUnverifiedInvocation(java.util.List<Invocation> invocations,
MatchableInvocation wanted,
InOrderContext context) |
static Invocation |
InvocationsFinder.findFirstUnverified(java.util.List<Invocation> invocations) |
(package private) static Invocation |
InvocationsFinder.findFirstUnverified(java.util.List<Invocation> invocations,
java.lang.Object mock) |
static Invocation |
InvocationsFinder.findFirstUnverifiedInOrder(InOrderContext context,
java.util.List<Invocation> orderedInvocations)
i3 is unverified here:
i1, i2, i3
v
all good here:
i1, i2, i3
v v
|
static java.util.List<Invocation> |
InvocationsFinder.findInvocations(java.util.List<Invocation> invocations,
MatchableInvocation wanted) |
static java.util.List<Invocation> |
InvocationsFinder.findMatchingChunk(java.util.List<Invocation> invocations,
MatchableInvocation wanted,
int wantedCount,
InOrderContext context)
some examples how it works:
Given invocations sequence:
1,1,2,1
if wanted is 1 and mode is times(2) then returns
1,1
if wanted is 1 and mode is atLeast() then returns
1,1,1
if wanted is 1 and mode is times(x), where x != 2 then returns
1,1,1
|
static Invocation |
InvocationsFinder.findPreviousVerifiedInOrder(java.util.List<Invocation> invocations,
InOrderContext context) |
static Invocation |
InvocationsFinder.findSimilarInvocation(java.util.List<Invocation> invocations,
MatchableInvocation wanted) |
static java.util.List<Location> |
InvocationsFinder.getAllLocations(java.util.List<Invocation> invocations) |
private static java.util.List<Invocation> |
InvocationsFinder.getFirstMatchingChunk(MatchableInvocation wanted,
java.util.List<Invocation> unverified) |
static Location |
InvocationsFinder.getLastLocation(java.util.List<Invocation> invocations) |
static void |
InvocationMarker.markVerified(java.util.List<Invocation> invocations,
MatchableInvocation wanted) |
static void |
InvocationMarker.markVerifiedInOrder(java.util.List<Invocation> chunk,
MatchableInvocation wanted,
InOrderContext context) |
private static java.util.List<Invocation> |
InvocationsFinder.removeVerifiedInOrder(java.util.List<Invocation> invocations,
InOrderContext orderingContext) |
Constructor and Description |
---|
InvocationMatcher(Invocation invocation) |
InvocationMatcher(Invocation invocation,
java.util.List<ArgumentMatcher> matchers) |
MatcherApplicationStrategy(Invocation invocation,
java.util.List<ArgumentMatcher<?>> matchers,
MatcherApplicationStrategy.MatcherApplicationType matchingType) |
Modifier and Type | Method and Description |
---|---|
static java.util.List<Invocation> |
AllInvocationsFinder.find(java.lang.Iterable<?> mocks)
gets all invocations from mocks.
|
static java.util.List<Invocation> |
VerifiableInvocationsFinder.find(java.util.List<?> mocks) |
Modifier and Type | Method and Description |
---|---|
boolean |
VerifiableInvocationsFinder.RemoveIgnoredForVerification.isOut(Invocation invocation) |
Modifier and Type | Field and Description |
---|---|
(package private) java.util.Map<Invocation,java.util.Set<Invocation>> |
StubbingArgMismatches.mismatches |
(package private) java.util.Map<Invocation,java.util.Set<Invocation>> |
StubbingArgMismatches.mismatches |
Modifier and Type | Method and Description |
---|---|
java.util.Collection<Invocation> |
UnusedStubbingsFinder.getUnusedStubbingsByLocation(java.lang.Iterable<java.lang.Object> mocks)
Gets unused stubbings per location.
|
private static java.util.List<Invocation> |
DefaultStubbingLookupListener.potentialArgMismatches(Invocation invocation,
java.util.Collection<Stubbing> stubbings) |
Modifier and Type | Method and Description |
---|---|
void |
StubbingArgMismatches.add(Invocation invocation,
Invocation stubbing) |
private static java.util.List<Invocation> |
DefaultStubbingLookupListener.potentialArgMismatches(Invocation invocation,
java.util.Collection<Stubbing> stubbings) |
Modifier and Type | Field and Description |
---|---|
private Invocation |
StubbingLookupNotifier.Event.invocation |
Modifier and Type | Method and Description |
---|---|
Invocation |
StubbingLookupNotifier.Event.getInvocation() |
Invocation |
StubbingLookupEvent.getInvocation() |
Modifier and Type | Method and Description |
---|---|
static void |
StubbingLookupNotifier.notifyStubbedAnswerLookup(Invocation invocation,
Stubbing stubbingFound,
java.util.Collection<Stubbing> allStubbings,
CreationSettings creationSettings) |
Constructor and Description |
---|
Event(Invocation invocation,
Stubbing stubbing,
java.util.Collection<Stubbing> allStubbings,
MockCreationSettings mockSettings) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
PrintSettings.print(Invocation invocation) |
java.lang.String |
PrintSettings.print(java.util.List<ArgumentMatcher> matchers,
Invocation invocation) |
Constructor and Description |
---|
SmartPrinter(MatchableInvocation wanted,
Invocation actual,
java.lang.Integer... indexesOfMatchersToBeDescribedWithExtraTypeInfo) |
Modifier and Type | Method and Description |
---|---|
java.util.List<Invocation> |
InvocationContainerImpl.getInvocations() |
java.util.List<Invocation> |
OngoingStubbingImpl.getRegisteredInvocations() |
Modifier and Type | Method and Description |
---|---|
(package private) java.lang.Object |
InvocationContainerImpl.answerTo(Invocation invocation) |
StubbedInvocationMatcher |
InvocationContainerImpl.findAnswerFor(Invocation invocation) |
Modifier and Type | Method and Description |
---|---|
private java.lang.Class<?> |
ReturnsArgumentAt.inferArgumentType(Invocation invocation,
int argumentIndex) |
private void |
ReturnsArgumentAt.validateArgumentTypeCompatibility(Invocation invocation,
int argumentPosition) |
Modifier and Type | Method and Description |
---|---|
java.util.Collection<Invocation> |
DefaultMockingDetails.getInvocations() |
Modifier and Type | Field and Description |
---|---|
private Invocation |
SingleRegisteredInvocation.invocation |
Modifier and Type | Field and Description |
---|---|
private java.util.LinkedList<Invocation> |
DefaultRegisteredInvocations.invocations |
Modifier and Type | Method and Description |
---|---|
java.util.List<Invocation> |
SingleRegisteredInvocation.getAll() |
java.util.List<Invocation> |
DefaultRegisteredInvocations.getAll() |
java.util.List<Invocation> |
RegisteredInvocations.getAll() |
java.util.List<Invocation> |
VerificationDataImpl.getAllInvocations() |
Modifier and Type | Method and Description |
---|---|
void |
SingleRegisteredInvocation.add(Invocation invocation) |
void |
DefaultRegisteredInvocations.add(Invocation invocation) |
void |
RegisteredInvocations.add(Invocation invocation) |
boolean |
DefaultRegisteredInvocations.RemoveToString.isOut(Invocation invocation) |
boolean |
InOrderContextImpl.isVerified(Invocation invocation) |
void |
InOrderContextImpl.markVerified(Invocation i) |
Modifier and Type | Method and Description |
---|---|
private void |
AtMost.removeAlreadyVerified(java.util.List<Invocation> invocations) |
Modifier and Type | Field and Description |
---|---|
private java.util.List<Invocation> |
VerificationDataInOrderImpl.allInvocations |
Modifier and Type | Method and Description |
---|---|
java.util.List<Invocation> |
VerificationData.getAllInvocations()
All invocations recorded on the mock object that is being verified.
|
java.util.List<Invocation> |
VerificationDataInOrder.getAllInvocations() |
java.util.List<Invocation> |
VerificationDataInOrderImpl.getAllInvocations() |
Modifier and Type | Method and Description |
---|---|
boolean |
InOrderContext.isVerified(Invocation invocation) |
void |
InOrderContext.markVerified(Invocation i) |
Constructor and Description |
---|
VerificationDataInOrderImpl(InOrderContext inOrder,
java.util.List<Invocation> allInvocations,
MatchableInvocation wanted) |
Modifier and Type | Method and Description |
---|---|
static void |
AtLeastXNumberOfInvocationsChecker.checkAtLeastNumberOfInvocations(java.util.List<Invocation> invocations,
MatchableInvocation wanted,
int wantedCount) |
static void |
AtLeastXNumberOfInvocationsChecker.checkAtLeastNumberOfInvocations(java.util.List<Invocation> invocations,
MatchableInvocation wanted,
int wantedCount,
InOrderContext orderingContext) |
static void |
MissingInvocationChecker.checkMissingInvocation(java.util.List<Invocation> invocations,
MatchableInvocation wanted) |
static void |
MissingInvocationChecker.checkMissingInvocation(java.util.List<Invocation> invocations,
MatchableInvocation wanted,
InOrderContext context) |
static void |
NumberOfInvocationsChecker.checkNumberOfInvocations(java.util.List<Invocation> invocations,
MatchableInvocation wanted,
int wantedCount) |
static void |
NumberOfInvocationsChecker.checkNumberOfInvocations(java.util.List<Invocation> invocations,
MatchableInvocation wanted,
int wantedCount,
InOrderContext context) |
static void |
NumberOfInvocationsChecker.checkNumberOfInvocationsNonGreedy(java.util.List<Invocation> invocations,
MatchableInvocation wanted,
int wantedCount,
InOrderContext context) |
Modifier and Type | Method and Description |
---|---|
Invocation |
InvocationFactory.createInvocation(java.lang.Object target,
MockCreationSettings settings,
java.lang.reflect.Method method,
java.util.concurrent.Callable realMethod,
java.lang.Object... args)
Deprecated.
Use
InvocationFactory.createInvocation(Object, MockCreationSettings, Method, RealMethodBehavior, Object...) instead.
Why deprecated? We found use cases where we need to handle Throwable and ensure correct stack trace filtering
(removing Mockito internals from the stack trace). Hence the introduction of InvocationFactory.RealMethodBehavior .
Creates instance of an Invocation object.
This method is useful for framework integrators to programmatically simulate method calls on mocks using MockHandler .
It enables advanced framework integrations. |
Invocation |
InvocationFactory.createInvocation(java.lang.Object target,
MockCreationSettings settings,
java.lang.reflect.Method method,
InvocationFactory.RealMethodBehavior realMethod,
java.lang.Object... args)
Creates instance of an
Invocation object. |
Invocation |
MatchableInvocation.getInvocation()
The actual invocation Mockito will match against.
|
Modifier and Type | Method and Description |
---|---|
void |
MatchableInvocation.captureArgumentsFrom(Invocation invocation)
This method is used by Mockito to implement argument captor functionality (see
ArgumentCaptor . |
java.lang.Object |
MockHandler.handle(Invocation invocation)
Takes an invocation object and handles it.
|
boolean |
MatchableInvocation.hasSameMethod(Invocation candidate)
Returns true if the candidate invocation has the same method (method name and parameter types)
|
boolean |
MatchableInvocation.hasSimilarMethod(Invocation candidate)
Candidate invocation has the similar method.
|
boolean |
MatchableInvocation.matches(Invocation candidate)
Same method, mock and all arguments match.
|
Modifier and Type | Method and Description |
---|---|
Invocation |
Stubbing.getInvocation()
Returns the method invocation that is stubbed.
|