org.mockito.invocation
Interface Invocation

All Superinterfaces:
DescribedInvocation, InvocationOnMock, PrintableInvocation, java.io.Serializable
All Known Implementing Classes:
InvocationImpl

@Incubating
public interface Invocation
extends InvocationOnMock, DescribedInvocation

A method call on a mock object. Contains all information and state needed for the Mockito framework to operate. This API might be useful for developers who extend Mockito.

The javadoc does not have lots of examples or documentation because its audience is different. Vast majority of users don't need to use the Invocation. It's mostly useful for other framework authors that extend Mockito.

Since:
1.9.5

Method Summary
 Location getLocation()
          The place in the code where the invocation happened.
 java.lang.Object[] getRawArguments()
          Returns unprocessed arguments whereas InvocationOnMock.getArguments() returns arguments already processed (e.g.
 int getSequenceNumber()
           
 void ignoreForVerification()
          Configures this invocation to be ignored for verify-no-more-invocations or verification in order.
 boolean isIgnoredForVerification()
          Informs if the invocation participates in verify-no-more-invocations or verification in order.
 boolean isVerified()
           
 void markStubbed(StubInfo stubInfo)
          Marks this invocation as stubbed.
 void markVerified()
          Marks this invocation as verified so that it will not cause verification error at Mockito.verifyNoMoreInteractions(Object...)
 StubInfo stubInfo()
           
 
Methods inherited from interface org.mockito.invocation.InvocationOnMock
callRealMethod, getArguments, getMethod, getMock
 
Methods inherited from interface org.mockito.invocation.DescribedInvocation
toString
 

Method Detail

isVerified

boolean isVerified()
Returns:
whether the invocation has been already verified. Needed for Mockito.verifyNoMoreInteractions(Object...)

getSequenceNumber

int getSequenceNumber()
Returns:
the sequence number of the Invocation. Useful to determine the order of invocations. Used by verification in order.

getLocation

Location getLocation()
Description copied from interface: DescribedInvocation
The place in the code where the invocation happened.

Specified by:
getLocation in interface DescribedInvocation
Specified by:
getLocation in interface PrintableInvocation
Returns:
the location in code of this invocation.

getRawArguments

java.lang.Object[] getRawArguments()
Returns unprocessed arguments whereas InvocationOnMock.getArguments() returns arguments already processed (e.g. varargs expended, etc.).

Returns:
unprocessed arguments, exactly as provided to this invocation.

markVerified

void markVerified()
Marks this invocation as verified so that it will not cause verification error at Mockito.verifyNoMoreInteractions(Object...)


stubInfo

StubInfo stubInfo()
Returns:
the stubbing information for this invocation. May return null - this means the invocation was not stubbed.

markStubbed

void markStubbed(StubInfo stubInfo)
Marks this invocation as stubbed.

Parameters:
stubInfo - the information about stubbing.

isIgnoredForVerification

boolean isIgnoredForVerification()
Informs if the invocation participates in verify-no-more-invocations or verification in order.

Returns:
whether this invocation should be ignored for the purposes of verify-no-more-invocations or verification in order.

ignoreForVerification

void ignoreForVerification()
Configures this invocation to be ignored for verify-no-more-invocations or verification in order. See also isIgnoredForVerification()