Class MethodInvocation

java.lang.Object
org.spockframework.runtime.extension.MethodInvocation
All Implemented Interfaces:
IMethodInvocation

public class MethodInvocation extends Object implements IMethodInvocation
Author:
Peter Niederwieser
  • Constructor Details

  • Method Details

    • getSpec

      public SpecInfo getSpec()
      Description copied from interface: IMethodInvocation
      Returns the specification which this method invocation belongs to.
      Specified by:
      getSpec in interface IMethodInvocation
      Returns:
      the specification which this method invocation belongs to
    • getFeature

      public FeatureInfo 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 interface IMethodInvocation
      Returns:
      the feature which this method invocation belongs to
    • getIteration

      public IterationInfo 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 interface IMethodInvocation
      Returns:
      the iteration which this method invocation belongs to
    • getSharedInstance

      public Object getSharedInstance()
      Description copied from interface: IMethodInvocation
      Returns the Specification instance for @Shared fields.
      Specified by:
      getSharedInstance in interface IMethodInvocation
      Returns:
      the Specification instance for @Shared fields
    • getInstance

      public Object getInstance()
      Description copied from interface: IMethodInvocation
      Returns the Specification instance for the current iteration.
      Specified by:
      getInstance in interface IMethodInvocation
      Returns:
      the Specification instance for the current iteration
    • getTarget

      public Object 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 interface IMethodInvocation
      Returns:
      the target (receiver) of this method invocation
    • getMethod

      public MethodInfo getMethod()
      Description copied from interface: IMethodInvocation
      Returns the method invoked by this method invocation.
      Specified by:
      getMethod in interface IMethodInvocation
      Returns:
      the method invoked by this method invocation
    • getArguments

      public Object[] getArguments()
      Description copied from interface: IMethodInvocation
      Returns the arguments for this method invocation.
      Specified by:
      getArguments in interface IMethodInvocation
      Returns:
      the arguments for this method invocation
    • proceed

      public void proceed() throws Throwable
      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 interface IMethodInvocation
      Throws:
      Throwable - any exception thrown by the method call
    • invokeTargetMethod

      protected void invokeTargetMethod() throws Throwable
      Throws:
      Throwable