类 ProfileValueUtils
- java.lang.Object
- org.springframework.test.annotation.ProfileValueUtils
public abstract class ProfileValueUtils extends Object
General utility methods for working with profile values.- 从以下版本开始:
- 2.5
- 作者:
- Sam Brannen, Juergen Hoeller
- 另请参阅:
ProfileValueSource,ProfileValueSourceConfiguration,IfProfileValue
构造器概要
构造器 构造器 说明 ProfileValueUtils()
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static booleanisTestEnabledInThisEnvironment(Class<?> testClass)Determine if the suppliedtestClassis enabled in the current environment, as specified by the@IfProfileValueannotation at the class level.static booleanisTestEnabledInThisEnvironment(Method testMethod, Class<?> testClass)Determine if the suppliedtestMethodis enabled in the current environment, as specified by the@IfProfileValueannotation, which may be declared on the test method itself or at the class level.static booleanisTestEnabledInThisEnvironment(ProfileValueSource profileValueSource, Method testMethod, Class<?> testClass)Determine if the suppliedtestMethodis enabled in the current environment, as specified by the@IfProfileValueannotation, which may be declared on the test method itself or at the class level.static ProfileValueSourceretrieveProfileValueSource(Class<?> testClass)Retrieves theProfileValueSourcetype for the specifiedtest classas configured via the@ProfileValueSourceConfigurationannotation and instantiates a new instance of that type.
构造器详细资料
ProfileValueUtils
public ProfileValueUtils()
方法详细资料
retrieveProfileValueSource
public static ProfileValueSource retrieveProfileValueSource(Class<?> testClass)
Retrieves theProfileValueSourcetype for the specifiedtest classas configured via the@ProfileValueSourceConfigurationannotation and instantiates a new instance of that type.If
@ProfileValueSourceConfigurationis not present on the specified class or if a customProfileValueSourceis not declared, the defaultSystemProfileValueSourcewill be returned instead.- 参数:
testClass- The test class for which the ProfileValueSource should be retrieved- 返回:
- the configured (or default) ProfileValueSource for the specified class
- 另请参阅:
SystemProfileValueSource
isTestEnabledInThisEnvironment
public static boolean isTestEnabledInThisEnvironment(Class<?> testClass)
Determine if the suppliedtestClassis enabled in the current environment, as specified by the@IfProfileValueannotation at the class level.Defaults to
trueif no@IfProfileValueannotation is declared.- 参数:
testClass- the test class- 返回:
trueif the test is enabled in the current environment
isTestEnabledInThisEnvironment
public static boolean isTestEnabledInThisEnvironment(Method testMethod, Class<?> testClass)
Determine if the suppliedtestMethodis enabled in the current environment, as specified by the@IfProfileValueannotation, which may be declared on the test method itself or at the class level. Class-level usage overrides method-level usage.Defaults to
trueif no@IfProfileValueannotation is declared.- 参数:
testMethod- the test methodtestClass- the test class- 返回:
trueif the test is enabled in the current environment
isTestEnabledInThisEnvironment
public static boolean isTestEnabledInThisEnvironment(ProfileValueSource profileValueSource, Method testMethod, Class<?> testClass)
Determine if the suppliedtestMethodis enabled in the current environment, as specified by the@IfProfileValueannotation, which may be declared on the test method itself or at the class level. Class-level usage overrides method-level usage.Defaults to
trueif no@IfProfileValueannotation is declared.- 参数:
profileValueSource- the ProfileValueSource to use to determine if the test is enabledtestMethod- the test methodtestClass- the test class- 返回:
trueif the test is enabled in the current environment