Class ConstructorInvocation<T>

java.lang.Object
org.junit.jupiter.engine.execution.ConstructorInvocation<T>
All Implemented Interfaces:
InvocationInterceptor.Invocation<T>, ReflectiveInvocationContext<Constructor<T>>

class ConstructorInvocation<T> extends Object implements InvocationInterceptor.Invocation<T>, ReflectiveInvocationContext<Constructor<T>>
  • Field Details

    • constructor

      private final Constructor<T> constructor
    • arguments

      private final Object[] arguments
  • Constructor Details

    • ConstructorInvocation

      ConstructorInvocation(Constructor<T> constructor, Object[] arguments)
  • Method Details

    • getTargetClass

      public Class<?> getTargetClass()
      Description copied from interface: ReflectiveInvocationContext
      Get the target class of this invocation context.

      If this invocation context represents an instance method, this method returns the class of the object the method will be invoked on, not the class it is declared in. Otherwise, if this invocation represents a static method or constructor, this method returns the class the method or constructor is declared in.

      Specified by:
      getTargetClass in interface ReflectiveInvocationContext<T>
      Returns:
      the target class of this invocation context; never null
    • getExecutable

      public Constructor<T> getExecutable()
      Description copied from interface: ReflectiveInvocationContext
      Get the method or constructor of this invocation context.
      Specified by:
      getExecutable in interface ReflectiveInvocationContext<T>
      Returns:
      the executable of this invocation context; never null
    • getArguments

      public List<Object> getArguments()
      Description copied from interface: ReflectiveInvocationContext
      Get the arguments of the executable in this invocation context.
      Specified by:
      getArguments in interface ReflectiveInvocationContext<T>
      Returns:
      the arguments of the executable in this invocation context; immutable and never null
    • getTarget

      public Optional<Object> getTarget()
      Description copied from interface: ReflectiveInvocationContext
      Get the target object of this invocation context, if available.

      If this invocation context represents an instance method, this method returns the object the method will be invoked on. Otherwise, if this invocation context represents a static method or constructor, this method returns empty().

      Specified by:
      getTarget in interface ReflectiveInvocationContext<T>
      Returns:
      the target of the executable of this invocation context; never null but potentially empty
    • proceed

      public T proceed()
      Description copied from interface: InvocationInterceptor.Invocation
      Proceed with this invocation.
      Specified by:
      proceed in interface InvocationInterceptor.Invocation<T>
      Returns:
      the result of this invocation; potentially null.