org.mockito.internal.invocation
Class Invocation

java.lang.Object
  extended by org.mockito.internal.invocation.Invocation
All Implemented Interfaces:
java.io.Serializable, PrintableInvocation, VerificationAwareInvocation, PrintingFriendlyInvocation, InvocationOnMock

public class Invocation
extends java.lang.Object
implements PrintableInvocation, InvocationOnMock, PrintingFriendlyInvocation, VerificationAwareInvocation

Method call on a mock object.

Contains sequence number which should be globally unique and is used for verification in order.

Contains stack trace of invocation

See Also:
Serialized Form

Constructor Summary
Invocation(java.lang.Object mock, MockitoMethod mockitoMethod, java.lang.Object[] args, int sequenceNumber, RealMethod realMethod)
           
 
Method Summary
protected  java.util.List<org.hamcrest.Matcher> argumentsToMatchers()
           
 java.lang.Object callRealMethod()
          calls real method
 boolean equals(java.lang.Object o)
           
 java.lang.Object[] getArguments()
          returns arguments passed to the method
 int getArgumentsCount()
           
 Location getLocation()
           
 java.lang.reflect.Method getMethod()
          returns the method
 java.lang.String getMethodName()
           
 java.lang.Object getMock()
          returns the mock object
 java.lang.Object[] getRawArguments()
           
 java.lang.Integer getSequenceNumber()
           
 int hashCode()
           
 void ignoreForVerification()
           
 boolean isDeclaredOnInterface()
           
 boolean isIgnoredForVerification()
           
 boolean isToString()
           
 boolean isValidException(java.lang.Throwable throwable)
           
 boolean isValidReturnType(java.lang.Class clazz)
           
 boolean isVerified()
           
 boolean isVoid()
           
 void markStubbed(StubInfo stubInfo)
           
 java.lang.String printMethodReturnType()
           
 boolean returnsPrimitive()
           
 StubInfo stubInfo()
           
 java.lang.String toString()
           
protected  java.lang.String toString(java.util.List<org.hamcrest.Matcher> matchers, PrintSettings printSettings)
           
 java.lang.String toString(PrintSettings printSettings)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Invocation

public Invocation(java.lang.Object mock,
                  MockitoMethod mockitoMethod,
                  java.lang.Object[] args,
                  int sequenceNumber,
                  RealMethod realMethod)
Method Detail

getMock

public java.lang.Object getMock()
Description copied from interface: InvocationOnMock
returns the mock object

Specified by:
getMock in interface InvocationOnMock
Returns:
mock object

getMethod

public java.lang.reflect.Method getMethod()
Description copied from interface: InvocationOnMock
returns the method

Specified by:
getMethod in interface InvocationOnMock
Returns:
method

getArguments

public java.lang.Object[] getArguments()
Description copied from interface: InvocationOnMock
returns arguments passed to the method

Specified by:
getArguments in interface InvocationOnMock
Returns:
arguments

isVerified

public boolean isVerified()
Specified by:
isVerified in interface VerificationAwareInvocation

getSequenceNumber

public java.lang.Integer getSequenceNumber()

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Specified by:
toString in interface PrintableInvocation
Overrides:
toString in class java.lang.Object

toString

protected java.lang.String toString(java.util.List<org.hamcrest.Matcher> matchers,
                                    PrintSettings printSettings)

argumentsToMatchers

protected java.util.List<org.hamcrest.Matcher> argumentsToMatchers()

isToString

public boolean isToString()

isValidException

public boolean isValidException(java.lang.Throwable throwable)

isValidReturnType

public boolean isValidReturnType(java.lang.Class clazz)

isVoid

public boolean isVoid()

printMethodReturnType

public java.lang.String printMethodReturnType()

getMethodName

public java.lang.String getMethodName()

returnsPrimitive

public boolean returnsPrimitive()

getLocation

public Location getLocation()
Specified by:
getLocation in interface PrintableInvocation

getArgumentsCount

public int getArgumentsCount()

getRawArguments

public java.lang.Object[] getRawArguments()

callRealMethod

public java.lang.Object callRealMethod()
                                throws java.lang.Throwable
Description copied from interface: InvocationOnMock
calls real method

Warning: depending on the real implementation it might throw exceptions

Specified by:
callRealMethod in interface InvocationOnMock
Returns:
whatever the real method returns / throws
Throws:
java.lang.Throwable - in case real method throws

isDeclaredOnInterface

public boolean isDeclaredOnInterface()

toString

public java.lang.String toString(PrintSettings printSettings)
Specified by:
toString in interface PrintingFriendlyInvocation

stubInfo

public StubInfo stubInfo()

markStubbed

public void markStubbed(StubInfo stubInfo)

isIgnoredForVerification

public boolean isIgnoredForVerification()

ignoreForVerification

public void ignoreForVerification()