Top Fields Constructors Methods
org.junit.jupiter.params.provider

pack-priv Class MethodArgumentsProvider

extends AnnotationBasedArgumentsProvider<MethodSource>
Class Inheritance
Static Imports
java.util.Arrays.stream, org.junit.platform.commons.support.AnnotationSupport.isAnnotated, org.junit.platform.commons.util.CollectionUtils.isConvertibleToStream

Since
5.0

Field Summary

Modifier and TypeField and Description
private static final Predicate<Method>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static Method
findFactoryMethod(Class<?> testClass, Optional<Method> testMethod, String factoryMethodName)

pack-priv static Method
findFactoryMethodByFullyQualifiedName(Class<?> testClass, Optional<Method> testMethod, String fullyQualifiedMethodName)

private static Method

Returns:

the single factory method matching the search criteria
findFactoryMethodBySimpleName
(Class<?> clazz, Optional<Method> testMethod, String factoryMethodName)

Find the factory method by searching for all methods in the given clazz with the desired factoryMethodName which have return types that can be converted to a Stream, ignoring the testMethod itself as well as any @Test, @TestTemplate, or @TestFactory methods with the same name.

private static boolean
isTestMethod(Method candidate)

private static boolean
protected Stream<? extends Arguments>
provideArguments(ParameterDeclarations parameters, ExtensionContext context, MethodSource methodSource)

Overrides org.junit.jupiter.params.provider.AnnotationBasedArgumentsProvider.provideArguments.

The returned Stream will be properly closed by the default implementation of provideArguments(ParameterDeclarations, ExtensionContext), making it safe to use a resource such as Files.lines().

private static Method
validateFactoryMethod(Method factoryMethod, @Nullable Object testInstance)

Inherited from org.junit.jupiter.params.provider.AnnotationBasedArgumentsProvider:
acceptprovideArgumentsprovideArguments

Field Detail

isFactoryMethodback to summary
private static final Predicate<Method> isFactoryMethod

Constructor Detail

MethodArgumentsProviderback to summary
pack-priv MethodArgumentsProvider()

Method Detail

findFactoryMethodback to summary
private static Method findFactoryMethod(Class<?> testClass, Optional<Method> testMethod, String factoryMethodName)
findFactoryMethodByFullyQualifiedNameback to summary
pack-priv static Method findFactoryMethodByFullyQualifiedName(Class<?> testClass, Optional<Method> testMethod, String fullyQualifiedMethodName)
findFactoryMethodBySimpleNameback to summary
private static Method findFactoryMethodBySimpleName(Class<?> clazz, Optional<Method> testMethod, String factoryMethodName)

Find the factory method by searching for all methods in the given clazz with the desired factoryMethodName which have return types that can be converted to a Stream, ignoring the testMethod itself as well as any @Test, @TestTemplate, or @TestFactory methods with the same name.

Returns:Method

the single factory method matching the search criteria

Exceptions
PreconditionViolationException:
if the factory method was not found or multiple competing factory methods with the same name were found
isTestMethodback to summary
private static boolean isTestMethod(Method candidate)
looksLikeAFullyQualifiedMethodNameback to summary
private static boolean looksLikeAFullyQualifiedMethodName(String factoryMethodName)
provideArgumentsback to summary
protected Stream<? extends Arguments> provideArguments(ParameterDeclarations parameters, ExtensionContext context, MethodSource methodSource)

Overrides org.junit.jupiter.params.provider.AnnotationBasedArgumentsProvider.provideArguments.

Doc from org.junit.jupiter.params.provider.AnnotationBasedArgumentsProvider.provideArguments.

The returned Stream will be properly closed by the default implementation of provideArguments(ParameterDeclarations, ExtensionContext), making it safe to use a resource such as Files.lines().

Annotations
@Override
validateFactoryMethodback to summary
private static Method validateFactoryMethod(Method factoryMethod, @Nullable Object testInstance)