Package org.junit.jupiter.params
Class ParameterizedTestExtension
java.lang.Object
org.junit.jupiter.params.ParameterizedTestExtension
- All Implemented Interfaces:
Extension,TestTemplateInvocationContextProvider
- Since:
- 5.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionarguments(ArgumentsProvider provider, ExtensionContext context) private Object[]consumedArguments(Object[] arguments, ParameterizedTestMethodContext methodContext) private TestTemplateInvocationContextcreateInvocationContext(ParameterizedTestNameFormatter formatter, ParameterizedTestMethodContext methodContext, Object[] arguments) private ParameterizedTestNameFormattercreateNameFormatter(Method templateMethod, ParameterizedTestMethodContext methodContext, String displayName, int argumentMaxLength) private ExtensionContext.StoregetStore(ExtensionContext context) private ArgumentsProviderinstantiateArgumentsProvider(Class<? extends ArgumentsProvider> clazz) provideTestTemplateInvocationContexts(ExtensionContext extensionContext) Provide invocation contexts for the test template method represented by the suppliedcontext.booleansupportsTestTemplate(ExtensionContext context) Determine if this provider supports providing invocation contexts for the test template method represented by the suppliedcontext.
-
Field Details
-
METHOD_CONTEXT_KEY
- See Also:
-
ARGUMENT_MAX_LENGTH_KEY
- See Also:
-
-
Constructor Details
-
ParameterizedTestExtension
ParameterizedTestExtension()
-
-
Method Details
-
supportsTestTemplate
Description copied from interface:TestTemplateInvocationContextProviderDetermine if this provider supports providing invocation contexts for the test template method represented by the suppliedcontext.- Specified by:
supportsTestTemplatein interfaceTestTemplateInvocationContextProvider- Parameters:
context- the extension context for the test template method about to be invoked; nevernull- Returns:
trueif this provider can provide invocation contexts- See Also:
-
provideTestTemplateInvocationContexts
public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContexts(ExtensionContext extensionContext) Description copied from interface:TestTemplateInvocationContextProviderProvide invocation contexts for the test template method represented by the suppliedcontext.This method is only called by the framework if
TestTemplateInvocationContextProvider.supportsTestTemplate(org.junit.jupiter.api.extension.ExtensionContext)previously returnedtruefor the sameExtensionContext; this method is allowed to return an emptyStreambut notnull.The returned
Streamwill be properly closed by callingBaseStream.close(), making it safe to use a resource such asFiles.lines().- Specified by:
provideTestTemplateInvocationContextsin interfaceTestTemplateInvocationContextProvider- Parameters:
extensionContext- the extension context for the test template method about to be invoked; nevernull- Returns:
- a
StreamofTestTemplateInvocationContextinstances for the invocation of the test template method; nevernull - See Also:
-
instantiateArgumentsProvider
-
getStore
-
createInvocationContext
private TestTemplateInvocationContext createInvocationContext(ParameterizedTestNameFormatter formatter, ParameterizedTestMethodContext methodContext, Object[] arguments) -
createNameFormatter
private ParameterizedTestNameFormatter createNameFormatter(Method templateMethod, ParameterizedTestMethodContext methodContext, String displayName, int argumentMaxLength) -
arguments
protected static Stream<? extends Arguments> arguments(ArgumentsProvider provider, ExtensionContext context) -
consumedArguments
private Object[] consumedArguments(Object[] arguments, ParameterizedTestMethodContext methodContext)
-