Class MethodArgumentsProvider
java.lang.Object
org.junit.jupiter.params.provider.AnnotationBasedArgumentsProvider<MethodSource>
org.junit.jupiter.params.provider.MethodArgumentsProvider
- All Implemented Interfaces:
Consumer<MethodSource>, ArgumentsProvider, AnnotationConsumer<MethodSource>
- Since:
- 5.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static MethodfindFactoryMethod(Class<?> testClass, Optional<Method> testMethod, String factoryMethodName) (package private) static MethodfindFactoryMethodByFullyQualifiedName(Class<?> testClass, Optional<Method> testMethod, String fullyQualifiedMethodName) private static MethodfindFactoryMethodBySimpleName(Class<?> clazz, Optional<Method> testMethod, String factoryMethodName) Find the factory method by searching for all methods in the givenclazzwith the desiredfactoryMethodNamewhich have return types that can be converted to aStream, ignoring thetestMethoditself as well as any@Test,@TestTemplate, or@TestFactorymethods with the same name.private static booleanisTestMethod(Method candidate) private static booleanlooksLikeAFullyQualifiedMethodName(String factoryMethodName) provideArguments(ParameterDeclarations parameters, org.junit.jupiter.api.extension.ExtensionContext context, MethodSource methodSource) The returnedStreamwill beproperly closedby the default implementation ofAnnotationBasedArgumentsProvider.provideArguments(ParameterDeclarations, ExtensionContext), making it safe to use a resource such asFiles.lines().private static MethodvalidateFactoryMethod(Method factoryMethod, Object testInstance) Methods inherited from class AnnotationBasedArgumentsProvider
accept, provideArguments, provideArgumentsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ArgumentsProvider
provideArguments
-
Field Details
-
isFactoryMethod
-
-
Constructor Details
-
MethodArgumentsProvider
MethodArgumentsProvider()
-
-
Method Details
-
provideArguments
protected Stream<? extends Arguments> provideArguments(ParameterDeclarations parameters, org.junit.jupiter.api.extension.ExtensionContext context, MethodSource methodSource) Description copied from class:AnnotationBasedArgumentsProviderThe returnedStreamwill beproperly closedby the default implementation ofAnnotationBasedArgumentsProvider.provideArguments(ParameterDeclarations, ExtensionContext), making it safe to use a resource such asFiles.lines().- Overrides:
provideArgumentsin classAnnotationBasedArgumentsProvider<MethodSource>
-
findFactoryMethod
-
looksLikeAFullyQualifiedMethodName
-
findFactoryMethodByFullyQualifiedName
-
findFactoryMethodBySimpleName
private static Method findFactoryMethodBySimpleName(Class<?> clazz, Optional<Method> testMethod, String factoryMethodName) Find the factory method by searching for all methods in the givenclazzwith the desiredfactoryMethodNamewhich have return types that can be converted to aStream, ignoring thetestMethoditself as well as any@Test,@TestTemplate, or@TestFactorymethods with the same name.- Returns:
- the single factory method matching the search criteria
- Throws:
org.junit.platform.commons.PreconditionViolationException- if the factory method was not found or multiple competing factory methods with the same name were found
-
isTestMethod
-
validateFactoryMethod
-