Class MethodInvocation
java.lang.Object
org.spockframework.runtime.extension.MethodInvocation
- All Implemented Interfaces:
IMethodInvocation
- Author:
- Peter Niederwieser
-
Constructor Summary
ConstructorsConstructorDescriptionMethodInvocation
(FeatureInfo feature, IterationInfo iteration, Object sharedInstance, Object instance, Object target, MethodInfo method, Object[] arguments) -
Method Summary
Modifier and TypeMethodDescriptionObject[]
Returns the arguments for this method invocation.Returns the feature which this method invocation belongs to (if any).Returns the Specification instance for the current iteration.Return the iteration which this method invocation belongs to (if any).Returns the method invoked by this method invocation.Returns the Specification instance for @Shared fields.getSpec()
Returns the specification which this method invocation belongs to.Returns the target (receiver) of this method invocation.protected void
void
proceed()
Proceeds with the method call.
-
Constructor Details
-
MethodInvocation
public MethodInvocation(FeatureInfo feature, IterationInfo iteration, Object sharedInstance, Object instance, Object target, MethodInfo method, Object[] arguments)
-
-
Method Details
-
getSpec
Description copied from interface:IMethodInvocation
Returns the specification which this method invocation belongs to.- Specified by:
getSpec
in interfaceIMethodInvocation
- Returns:
- the specification which this method invocation belongs to
-
getFeature
Description copied from interface:IMethodInvocation
Returns the feature which this method invocation belongs to (if any). Differs from MethodInfo.getFeature() in that it reflects the dynamic picture. For example, when a setup method is invoked, this method will return the corresponding feature, whereas MethodInfo.getFeature() will return null.- Specified by:
getFeature
in interfaceIMethodInvocation
- Returns:
- the feature which this method invocation belongs to
-
getIteration
Description copied from interface:IMethodInvocation
Return the iteration which this method invocation belongs to (if any). Executing a feature results in at least one but possibly more iterations (e.g. for a data-driven feature).- Specified by:
getIteration
in interfaceIMethodInvocation
- Returns:
- the iteration which this method invocation belongs to
-
getInstance
Description copied from interface:IMethodInvocation
Returns the Specification instance for the current iteration.- Specified by:
getInstance
in interfaceIMethodInvocation
- Returns:
- the Specification instance for the current iteration
-
getTarget
Description copied from interface:IMethodInvocation
Returns the target (receiver) of this method invocation. In case of a static method call, a Class instance is returned.- Specified by:
getTarget
in interfaceIMethodInvocation
- Returns:
- the target (receiver) of this method invocation
-
getMethod
Description copied from interface:IMethodInvocation
Returns the method invoked by this method invocation.- Specified by:
getMethod
in interfaceIMethodInvocation
- Returns:
- the method invoked by this method invocation
-
getArguments
Description copied from interface:IMethodInvocation
Returns the arguments for this method invocation.- Specified by:
getArguments
in interfaceIMethodInvocation
- Returns:
- the arguments for this method invocation
-
proceed
Description copied from interface:IMethodInvocation
Proceeds with the method call. Always call this method unless you want to suppress the method call.- Specified by:
proceed
in interfaceIMethodInvocation
- Throws:
Throwable
- any exception thrown by the method call
-
invokeTargetMethod
- Throws:
Throwable
-