Module org.junit.jupiter.params
Class AnnotationBasedArgumentsProvider<A extends Annotation>
java.lang.Object
org.junit.jupiter.params.provider.AnnotationBasedArgumentsProvider<A>
- All Implemented Interfaces:
Consumer<A>,ArgumentsProvider,AnnotationConsumer<A>
@API(status=EXPERIMENTAL,
since="5.10")
public abstract class AnnotationBasedArgumentsProvider<A extends Annotation>
extends Object
implements ArgumentsProvider, AnnotationConsumer<A>
AnnotationBasedArgumentsProvider is an abstract base class for
ArgumentsProvider implementations that also need to consume an
annotation in order to provide the arguments.- Since:
- 5.10
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidprovideArguments(ExtensionContext context, A annotation) Deprecated.provideArguments(ParameterDeclarations parameters, ExtensionContext context) provideArguments(ParameterDeclarations parameters, ExtensionContext context, A annotation) The returnedStreamwill beproperly closedby the default implementation ofprovideArguments(ParameterDeclarations, ExtensionContext), making it safe to use a resource such asFiles.lines().Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.junit.jupiter.params.provider.ArgumentsProvider
provideArguments
-
Constructor Details
-
AnnotationBasedArgumentsProvider
public AnnotationBasedArgumentsProvider()
-
-
Method Details
-
accept
- Specified by:
acceptin interfaceConsumer<A extends Annotation>
-
provideArguments
public Stream<? extends Arguments> provideArguments(ParameterDeclarations parameters, ExtensionContext context) Description copied from interface:ArgumentsProvider- Specified by:
provideArgumentsin interfaceArgumentsProvider- Parameters:
parameters- the parameter declarations for the parameterized class or test; nevernullcontext- the current extension context; nevernull- Returns:
- a stream of arguments; never
null
-
provideArguments
@Deprecated protected Stream<? extends Arguments> provideArguments(ExtensionContext context, A annotation) Deprecated.Please implementprovideArguments(ParameterDeclarations, ExtensionContext, Annotation)instead.Provide aStreamofArguments— based on metadata in the provided annotation — to be passed to a@ParameterizedTestmethod.- Parameters:
context- the current extension context; nevernullannotation- the annotation to process; nevernull- Returns:
- a stream of arguments; never
null
-
provideArguments
protected Stream<? extends Arguments> provideArguments(ParameterDeclarations parameters, ExtensionContext context, A annotation) The returnedStreamwill beproperly closedby the default implementation ofprovideArguments(ParameterDeclarations, ExtensionContext), making it safe to use a resource such asFiles.lines().
-
provideArguments(ParameterDeclarations, ExtensionContext, Annotation)instead.