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.13
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ObjectThe key for retrieving theParameterInfoinstance from theStore.static final ExtensionContext.Namespace -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable ParameterInfoget(ExtensionContext context) Returns the closestParameterInfoinstance for the suppliedExtensionContext; potentiallynull.Returns the accessor to the arguments of the current invocation.Returns the declarations of all indexed parameters.
-
Field Details
-
NAMESPACE
-
KEY
-
-
Method Details
-
get
Returns the closestParameterInfoinstance for the suppliedExtensionContext; potentiallynull.- Returns:
- the closest
ParameterInfoinstance for the suppliedExtensionContext; potentiallynull
-
getDeclarations
ParameterDeclarations getDeclarations()Returns the declarations of all indexed parameters.- Returns:
- the declarations of all indexed parameters
-
getArguments
ArgumentsAccessor getArguments()Returns the accessor to the arguments of the current invocation.- Returns:
- the accessor to the arguments of the current invocation
-