Class ProfileValueUtils
- java.lang.Object
- org.springframework.test.annotation.ProfileValueUtils
public abstract class ProfileValueUtils extends Object
General utility methods for working with profile values.- Since:
- 2.5
- Author:
- Sam Brannen, Juergen Hoeller
- See Also:
ProfileValueSource,ProfileValueSourceConfiguration,IfProfileValue
Constructor Summary
Constructors Constructor Description ProfileValueUtils()
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.
Constructor Detail
ProfileValueUtils
public ProfileValueUtils()
Method Detail
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.- Parameters:
testClass- The test class for which the ProfileValueSource should be retrieved- Returns:
- the configured (or default) ProfileValueSource for the specified class
- See Also:
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.- Parameters:
testClass- the test class- Returns:
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.- Parameters:
testMethod- the test methodtestClass- the test class- Returns:
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.- Parameters:
profileValueSource- the ProfileValueSource to use to determine if the test is enabledtestMethod- the test methodtestClass- the test class- Returns:
trueif the test is enabled in the current environment