Interface ParameterInfo

  • All Known Subinterfaces:
    ParameterInfo
    All Known Implementing Classes:
    DefaultParameterInfo

    @API(status=EXPERIMENTAL,
         since="5.14")
    public interface ParameterInfo
    ParameterInfo is used to provide information about the current invocation of a parameterized class or test.

    Registered Extension implementations may retrieve the current ParameterInfo instance by calling ExtensionContext.getStore(Namespace) with NAMESPACE and Store.get(...) with KEY. Alternatively, the get(ExtensionContext) method may be used to retrieve the ParameterInfo instance for the supplied ExtensionContext. Extensions must not modify any entries in the Store for NAMESPACE.

    When a @ParameterizedTest method is declared inside a @ParameterizedClass or a @Nested @ParameterizedClass is declared inside an enclosing @ParameterizedClass, there will be multiple ParameterInfo instances available on different levels of the ExtensionContext hierarchy. In such cases, please use ExtensionContext.getParent() to navigate to the right level before retrieving the ParameterInfo instance from the Store.

    Since:
    5.14
    See Also:
    ParameterizedClass, ParameterizedTest
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.Object KEY
      The key for retrieving the ParameterInfo instance from the Store.
      static org.junit.jupiter.api.extension.ExtensionContext.Namespace NAMESPACE
      The ExtensionContext.Namespace for accessing the Store for ParameterInfo.
    • Field Detail

      • NAMESPACE

        static final org.junit.jupiter.api.extension.ExtensionContext.Namespace NAMESPACE
        The ExtensionContext.Namespace for accessing the Store for ParameterInfo.
      • KEY

        static final java.lang.Object KEY
        The key for retrieving the ParameterInfo instance from the Store.
    • Method Detail

      • get

        static ParameterInfo get​(org.junit.jupiter.api.extension.ExtensionContext context)
        {@return the closest {@code ParameterInfo} instance for the supplied {@code ExtensionContext}; potentially {@code null}}
      • getDeclarations

        ParameterDeclarations getDeclarations()
        {@return the declarations of all indexed parameters}
      • getArguments

        ArgumentsAccessor getArguments()
        {@return the accessor to the arguments of the current invocation}