public abstract class TestConstructorUtils extends Object
@TestConstructor.
Primarily intended for use within the framework.
TestConstructor| Modifier and Type | Method and Description |
|---|---|
static boolean |
isAutowirableConstructor(Constructor<?> constructor,
Class<?> testClass)
Determine if the supplied constructor for the given test class is
autowirable.
|
static boolean |
isAutowirableConstructor(Constructor<?> constructor,
Class<?> testClass,
PropertyProvider fallbackPropertyProvider)
Determine if the supplied constructor for the given test class is
autowirable.
|
static boolean |
isAutowirableConstructor(Executable executable,
Class<?> testClass)
Determine if the supplied executable for the given test class is an
autowirable constructor.
|
static boolean |
isAutowirableConstructor(Executable executable,
Class<?> testClass,
PropertyProvider fallbackPropertyProvider)
Determine if the supplied executable for the given test class is an
autowirable constructor.
|
public static boolean isAutowirableConstructor(Executable executable, Class<?> testClass)
This method delegates to isAutowirableConstructor(Executable, Class, PropertyProvider)
will a value of null for the fallback PropertyProvider.
executable - an executable for the test classtestClass - the test classtrue if the executable is an autowirable constructorisAutowirableConstructor(Executable, Class, PropertyProvider)public static boolean isAutowirableConstructor(Constructor<?> constructor, Class<?> testClass)
This method delegates to isAutowirableConstructor(Constructor, Class, PropertyProvider)
will a value of null for the fallback PropertyProvider.
constructor - a constructor for the test classtestClass - the test classtrue if the constructor is autowirableisAutowirableConstructor(Constructor, Class, PropertyProvider)public static boolean isAutowirableConstructor(Executable executable, Class<?> testClass, @Nullable PropertyProvider fallbackPropertyProvider)
This method delegates to isAutowirableConstructor(Constructor, Class, PropertyProvider)
if the supplied executable is a constructor and otherwise returns false.
executable - an executable for the test classtestClass - the test classfallbackPropertyProvider - fallback property provider used to look up
the value for TestConstructor.TEST_CONSTRUCTOR_AUTOWIRE_MODE_PROPERTY_NAME
if no such value is found in SpringPropertiestrue if the executable is an autowirable constructorisAutowirableConstructor(Constructor, Class, PropertyProvider)public static boolean isAutowirableConstructor(Constructor<?> constructor, Class<?> testClass, @Nullable PropertyProvider fallbackPropertyProvider)
A constructor is considered to be autowirable if one of the following
conditions is true.
@Autowired.@TestConstructor is present or
meta-present on the test class with
autowireMode set to
ALL.ALL in SpringProperties or in the supplied fallback
PropertyProvider (see
TestConstructor.TEST_CONSTRUCTOR_AUTOWIRE_MODE_PROPERTY_NAME).constructor - a constructor for the test classtestClass - the test classfallbackPropertyProvider - fallback property provider used to look up
the value for the default test constructor autowire mode if no
such value is found in SpringPropertiestrue if the constructor is autowirable