类 TestConstructorUtils
- java.lang.Object
- org.springframework.test.context.support.TestConstructorUtils
public abstract class TestConstructorUtils extends Object
Utility methods for working with@TestConstructor.Primarily intended for use within the framework.
- 从以下版本开始:
- 5.2
- 作者:
- Sam Brannen
- 另请参阅:
TestConstructor
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static booleanisAutowirableConstructor(Constructor<?> constructor, Class<?> testClass)Determine if the supplied constructor for the given test class is autowirable.static booleanisAutowirableConstructor(Executable executable, Class<?> testClass)Determine if the supplied executable for the given test class is an autowirable constructor.
方法详细资料
isAutowirableConstructor
public static boolean isAutowirableConstructor(Executable executable, Class<?> testClass)
Determine if the supplied executable for the given test class is an autowirable constructor.This method delegates to
isAutowirableConstructor(Constructor, Class)if the executable is a constructor.- 参数:
executable- an executable for the test classtestClass- the test class- 返回:
trueif the executable is an autowirable constructor- 另请参阅:
isAutowirableConstructor(Constructor, Class)
isAutowirableConstructor
public static boolean isAutowirableConstructor(Constructor<?> constructor, Class<?> testClass)
Determine if the supplied constructor for the given test class is autowirable.A constructor is considered to be autowirable if one of the following conditions is
true.- The constructor is annotated with
@Autowired. @TestConstructoris present or meta-present on the test class withautowireModeset toALL.- The default test constructor autowire mode has been changed to
ALL(seeTestConstructor.TEST_CONSTRUCTOR_AUTOWIRE_MODE_PROPERTY_NAME).
- 参数:
constructor- a constructor for the test classtestClass- the test class- 返回:
trueif the constructor is autowirable- 另请参阅:
isAutowirableConstructor(Executable, Class)
- The constructor is annotated with