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.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 |
---|---|
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 | 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(List<Invocation> unusedStubs,
List<InvocationMatcher> allInvocations) |
WarningsPrinterImpl(List<Invocation> unusedStubs,
List<InvocationMatcher> allInvocations,
boolean warnAboutUnstubbed) |
Modifier and Type | Method and Description |
---|---|
static MockitoAssertionError |
Reporter.noMoreInteractionsWanted(Invocation undesired,
List<VerificationAwareInvocation> invocations) |
static MockitoAssertionError |
Reporter.noMoreInteractionsWantedInOrder(Invocation undesired) |
static void |
Reporter.potentialStubbingProblem(Invocation actualInvocation,
Collection<Invocation> argMismatchStubbings) |
Modifier and Type | Method and Description |
---|---|
static UnnecessaryStubbingException |
Reporter.formatUnncessaryStubbingException(Class<?> testClass,
Collection<Invocation> unnecessaryStubbings) |
static void |
Reporter.potentialStubbingProblem(Invocation actualInvocation,
Collection<Invocation> argMismatchStubbings) |
static void |
Reporter.unncessaryStubbingException(List<Invocation> unused) |
Modifier and Type | Method and Description |
---|---|
Object |
MockHandlerImpl.handle(Invocation invocation) |
Constructor and Description |
---|
NotifiedMethodInvocationReport(Invocation invocation,
Object returnedValue)
Build a new
MethodInvocationReport with a return value. |
NotifiedMethodInvocationReport(Invocation invocation,
Throwable throwable)
Build a new
MethodInvocationReport with a return value. |
Modifier and Type | Class and Description |
---|---|
class |
InterceptedInvocation |
Modifier and Type | Method and Description |
---|---|
Invocation |
DefaultInvocationFactory.createInvocation(Object target,
MockCreationSettings settings,
Method method,
Callable realMethod,
Object... args) |
Invocation |
DefaultInvocationFactory.createInvocation(Object target,
MockCreationSettings settings,
Method method,
InvocationFactory.RealMethodBehavior realMethod,
Object... args) |
static Invocation |
InvocationsFinder.findFirstMatchingUnverifiedInvocation(List<Invocation> invocations,
MatchableInvocation wanted,
InOrderContext context) |
static Invocation |
InvocationsFinder.findFirstUnverified(List<Invocation> invocations) |
static Invocation |
InvocationsFinder.findFirstUnverifiedInOrder(InOrderContext context,
List<Invocation> orderedInvocations)
i3 is unverified here:
i1, i2, i3
v
all good here:
i1, i2, i3
v v
|
static Invocation |
InvocationsFinder.findPreviousVerifiedInOrder(List<Invocation> invocations,
InOrderContext context) |
static Invocation |
InvocationsFinder.findSimilarInvocation(List<Invocation> invocations,
MatchableInvocation wanted) |
Invocation |
InvocationMatcher.getInvocation() |
Modifier and Type | Method and Description |
---|---|
List<Invocation> |
UnusedStubsFinder.find(List<?> mocks)
Deprecated.
Finds all unused stubs for given mocks
|
static List<Invocation> |
InvocationsFinder.findAllMatchingUnverifiedChunks(List<Invocation> invocations,
MatchableInvocation wanted,
InOrderContext orderingContext) |
static List<Invocation> |
InvocationsFinder.findInvocations(List<Invocation> invocations,
MatchableInvocation wanted) |
static List<Invocation> |
InvocationsFinder.findMatchingChunk(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
|
Modifier and Type | Method and Description |
---|---|
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,
List<ArgumentMatcher<?>> matchers)
Returns the
MatcherApplicationStrategy that must be used to capture the
arguments of the given invocation using the given 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
|
static void |
InvocationMarker.markVerified(Invocation invocation,
MatchableInvocation wanted) |
boolean |
InvocationMatcher.matches(Invocation candidate) |
Modifier and Type | Method and Description |
---|---|
static List<InvocationMatcher> |
InvocationMatcher.createFrom(List<Invocation> invocations) |
static List<Invocation> |
InvocationsFinder.findAllMatchingUnverifiedChunks(List<Invocation> invocations,
MatchableInvocation wanted,
InOrderContext orderingContext) |
static Invocation |
InvocationsFinder.findFirstMatchingUnverifiedInvocation(List<Invocation> invocations,
MatchableInvocation wanted,
InOrderContext context) |
static Invocation |
InvocationsFinder.findFirstUnverified(List<Invocation> invocations) |
static Invocation |
InvocationsFinder.findFirstUnverifiedInOrder(InOrderContext context,
List<Invocation> orderedInvocations)
i3 is unverified here:
i1, i2, i3
v
all good here:
i1, i2, i3
v v
|
static List<Invocation> |
InvocationsFinder.findInvocations(List<Invocation> invocations,
MatchableInvocation wanted) |
static List<Invocation> |
InvocationsFinder.findMatchingChunk(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(List<Invocation> invocations,
InOrderContext context) |
static Invocation |
InvocationsFinder.findSimilarInvocation(List<Invocation> invocations,
MatchableInvocation wanted) |
static List<Location> |
InvocationsFinder.getAllLocations(List<Invocation> invocations) |
static Location |
InvocationsFinder.getLastLocation(List<Invocation> invocations) |
static void |
InvocationMarker.markVerified(List<Invocation> invocations,
MatchableInvocation wanted) |
static void |
InvocationMarker.markVerifiedInOrder(List<Invocation> chunk,
MatchableInvocation wanted,
InOrderContext context) |
Constructor and Description |
---|
InvocationMatcher(Invocation invocation) |
InvocationMatcher(Invocation invocation,
List<ArgumentMatcher> matchers) |
Modifier and Type | Method and Description |
---|---|
static List<Invocation> |
AllInvocationsFinder.find(Iterable<?> mocks)
gets all invocations from mocks.
|
static List<Invocation> |
VerifiableInvocationsFinder.find(List<?> mocks) |
Modifier and Type | Method and Description |
---|---|
Collection<Invocation> |
UnusedStubbingsFinder.getUnusedStubbingsByLocation(Iterable<Object> mocks)
Gets unused stubbings per location.
|
Modifier and Type | Method and Description |
---|---|
Invocation |
StubbingLookupEvent.getInvocation() |
Modifier and Type | Method and Description |
---|---|
static void |
StubbingLookupNotifier.notifyStubbedAnswerLookup(Invocation invocation,
Stubbing stubbingFound,
Collection<Stubbing> allStubbings,
CreationSettings creationSettings) |
Modifier and Type | Method and Description |
---|---|
String |
PrintSettings.print(Invocation invocation) |
String |
PrintSettings.print(List<ArgumentMatcher> matchers,
Invocation invocation) |
Constructor and Description |
---|
SmartPrinter(MatchableInvocation wanted,
Invocation actual,
Integer... indexesOfMatchersToBeDescribedWithExtraTypeInfo) |
Modifier and Type | Method and Description |
---|---|
List<Invocation> |
InvocationContainerImpl.getInvocations() |
List<Invocation> |
OngoingStubbingImpl.getRegisteredInvocations() |
Modifier and Type | Method and Description |
---|---|
StubbedInvocationMatcher |
InvocationContainerImpl.findAnswerFor(Invocation invocation) |
Modifier and Type | Method and Description |
---|---|
Collection<Invocation> |
DefaultMockingDetails.getInvocations() |
Modifier and Type | Method and Description |
---|---|
List<Invocation> |
SingleRegisteredInvocation.getAll() |
List<Invocation> |
DefaultRegisteredInvocations.getAll() |
List<Invocation> |
RegisteredInvocations.getAll() |
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 |
InOrderContextImpl.isVerified(Invocation invocation) |
void |
InOrderContextImpl.markVerified(Invocation i) |
Modifier and Type | Method and Description |
---|---|
List<Invocation> |
VerificationData.getAllInvocations()
All invocations recorded on the mock object that is being verified.
|
List<Invocation> |
VerificationDataInOrder.getAllInvocations() |
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,
List<Invocation> allInvocations,
MatchableInvocation wanted) |
Modifier and Type | Method and Description |
---|---|
static void |
AtLeastXNumberOfInvocationsChecker.checkAtLeastNumberOfInvocations(List<Invocation> invocations,
MatchableInvocation wanted,
int wantedCount) |
static void |
AtLeastXNumberOfInvocationsChecker.checkAtLeastNumberOfInvocations(List<Invocation> invocations,
MatchableInvocation wanted,
int wantedCount,
InOrderContext orderingContext) |
static void |
MissingInvocationChecker.checkMissingInvocation(List<Invocation> invocations,
MatchableInvocation wanted) |
static void |
MissingInvocationChecker.checkMissingInvocation(List<Invocation> invocations,
MatchableInvocation wanted,
InOrderContext context) |
static void |
NumberOfInvocationsChecker.checkNumberOfInvocations(List<Invocation> invocations,
MatchableInvocation wanted,
int wantedCount) |
static void |
NumberOfInvocationsChecker.checkNumberOfInvocations(List<Invocation> invocations,
MatchableInvocation wanted,
int wantedCount,
InOrderContext context) |
static void |
NumberOfInvocationsChecker.checkNumberOfInvocationsNonGreedy(List<Invocation> invocations,
MatchableInvocation wanted,
int wantedCount,
InOrderContext context) |
Modifier and Type | Method and Description |
---|---|
Invocation |
InvocationFactory.createInvocation(Object target,
MockCreationSettings settings,
Method method,
Callable realMethod,
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(Object target,
MockCreationSettings settings,
Method method,
InvocationFactory.RealMethodBehavior realMethod,
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 . |
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.
|
Copyright © 2020. All rights reserved.