类 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 boolean
isTestEnabledInThisEnvironment(Class<?> testClass)
Determine if the suppliedtestClass
is enabled in the current environment, as specified by the@IfProfileValue
annotation at the class level.static boolean
isTestEnabledInThisEnvironment(Method testMethod, Class<?> testClass)
Determine if the suppliedtestMethod
is enabled in the current environment, as specified by the@IfProfileValue
annotation, which may be declared on the test method itself or at the class level.static boolean
isTestEnabledInThisEnvironment(ProfileValueSource profileValueSource, Method testMethod, Class<?> testClass)
Determine if the suppliedtestMethod
is enabled in the current environment, as specified by the@IfProfileValue
annotation, which may be declared on the test method itself or at the class level.static ProfileValueSource
retrieveProfileValueSource(Class<?> testClass)
Retrieves theProfileValueSource
type for the specifiedtest class
as configured via the@ProfileValueSourceConfiguration
annotation and instantiates a new instance of that type.
构造器详细资料
ProfileValueUtils
public ProfileValueUtils()
方法详细资料
retrieveProfileValueSource
public static ProfileValueSource retrieveProfileValueSource(Class<?> testClass)
Retrieves theProfileValueSource
type for the specifiedtest class
as configured via the@ProfileValueSourceConfiguration
annotation and instantiates a new instance of that type.If
@ProfileValueSourceConfiguration
is not present on the specified class or if a customProfileValueSource
is not declared, the defaultSystemProfileValueSource
will 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 suppliedtestClass
is enabled in the current environment, as specified by the@IfProfileValue
annotation at the class level.Defaults to
true
if no@IfProfileValue
annotation is declared.- 参数:
testClass
- the test class- 返回:
true
if the test is enabled in the current environment
isTestEnabledInThisEnvironment
public static boolean isTestEnabledInThisEnvironment(Method testMethod, Class<?> testClass)
Determine if the suppliedtestMethod
is enabled in the current environment, as specified by the@IfProfileValue
annotation, which may be declared on the test method itself or at the class level. Class-level usage overrides method-level usage.Defaults to
true
if no@IfProfileValue
annotation is declared.- 参数:
testMethod
- the test methodtestClass
- the test class- 返回:
true
if the test is enabled in the current environment
isTestEnabledInThisEnvironment
public static boolean isTestEnabledInThisEnvironment(ProfileValueSource profileValueSource, Method testMethod, Class<?> testClass)
Determine if the suppliedtestMethod
is enabled in the current environment, as specified by the@IfProfileValue
annotation, which may be declared on the test method itself or at the class level. Class-level usage overrides method-level usage.Defaults to
true
if no@IfProfileValue
annotation is declared.- 参数:
profileValueSource
- the ProfileValueSource to use to determine if the test is enabledtestMethod
- the test methodtestClass
- the test class- 返回:
true
if the test is enabled in the current environment