Module org.junit.jupiter.params
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, Method testMethod, String factoryMethodName) (package private) static MethodfindFactoryMethodByFullyQualifiedName(Class<?> testClass, Method testMethod, String fullyQualifiedMethodName) private static MethodfindFactoryMethodBySimpleName(Class<?> clazz, 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 Class<?> loadRequiredClass(String className, ClassLoader classLoader) private static booleanlooksLikeAFullyQualifiedMethodName(String factoryMethodName) provideArguments(ExtensionContext context, MethodSource methodSource) private static ArgumentstoArguments(Object item) private static MethodvalidateFactoryMethod(Method factoryMethod, Object testInstance) Methods inherited from class org.junit.jupiter.params.provider.AnnotationBasedArgumentsProvider
accept, provideArguments
-
Field Details
-
isFactoryMethod
-
-
Constructor Details
-
MethodArgumentsProvider
MethodArgumentsProvider()
-
-
Method Details
-
provideArguments
protected Stream<? extends Arguments> provideArguments(ExtensionContext context, MethodSource methodSource) Description copied from class:AnnotationBasedArgumentsProviderProvide aStreamofArguments— based on metadata in the provided annotation — to be passed to a@ParameterizedTestmethod.- Specified by:
provideArgumentsin classAnnotationBasedArgumentsProvider<MethodSource>- Parameters:
context- the current extension context; nevernullmethodSource- the annotation to process; nevernull- Returns:
- a stream of arguments; never
null
-
findFactoryMethod
-
looksLikeAFullyQualifiedMethodName
-
findFactoryMethodByFullyQualifiedName
-
findFactoryMethodBySimpleName
private static Method findFactoryMethodBySimpleName(Class<?> clazz, 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:
PreconditionViolationException- if the factory method was not found or multiple competing factory methods with the same name were found
-
isTestMethod
-
loadRequiredClass
-
validateFactoryMethod
-
toArguments
-