Package org.spockframework.mock.runtime
Class MockInvocation
- java.lang.Object
-
- org.spockframework.mock.runtime.MockInvocation
-
- All Implemented Interfaces:
IMockInvocation
public class MockInvocation extends java.lang.Object implements IMockInvocation
- Author:
- Peter Niederwieser
-
-
Constructor Summary
Constructors Constructor Description MockInvocation(IMockObject mockObject, IMockMethod method, java.util.List<java.lang.Object> arguments, IResponseGenerator realMethodInvoker)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectcallRealMethod()Delegates this method invocation to the real object underlying this mock object, including any method arguments.java.lang.ObjectcallRealMethodWithArgs(java.lang.Object... arguments)Delegates this method invocation to the real object underlying this mock object, replacing the original method arguments with the specified arguments.booleanequals(java.lang.Object other)java.util.List<java.lang.Object>getArguments()The arguments for the invocation.IMockMethodgetMethod()The invoked method.IMockObjectgetMockObject()The mock object that received the invocation.inthashCode()java.lang.StringtoString()
-
-
-
Constructor Detail
-
MockInvocation
public MockInvocation(IMockObject mockObject, IMockMethod method, java.util.List<java.lang.Object> arguments, IResponseGenerator realMethodInvoker)
-
-
Method Detail
-
getMockObject
public IMockObject getMockObject()
Description copied from interface:IMockInvocationThe mock object that received the invocation.- Specified by:
getMockObjectin interfaceIMockInvocation
-
getMethod
public IMockMethod getMethod()
Description copied from interface:IMockInvocationThe invoked method.- Specified by:
getMethodin interfaceIMockInvocation
-
getArguments
public java.util.List<java.lang.Object> getArguments()
Description copied from interface:IMockInvocationThe arguments for the invocation.- Specified by:
getArgumentsin interfaceIMockInvocation
-
callRealMethod
public java.lang.Object callRealMethod()
Description copied from interface:IMockInvocationDelegates this method invocation to the real object underlying this mock object, including any method arguments. If this mock object has no underlying real object, aCannotInvokeRealMethodExceptionis thrown.- Specified by:
callRealMethodin interfaceIMockInvocation- Returns:
- the return value of the method to which this invocation was delegated
-
callRealMethodWithArgs
public java.lang.Object callRealMethodWithArgs(java.lang.Object... arguments)
Description copied from interface:IMockInvocationDelegates this method invocation to the real object underlying this mock object, replacing the original method arguments with the specified arguments. If this mock object has no underlying real object, aCannotInvokeRealMethodExceptionis thrown.- Specified by:
callRealMethodWithArgsin interfaceIMockInvocation- Returns:
- the return value of the method to which this invocation was delegated
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-