Class ProfileValueChecker
- java.lang.Object
- org.junit.runners.model.Statement
- org.springframework.test.context.junit4.statements.ProfileValueChecker
public class ProfileValueChecker extends Statement
ProfileValueCheckeris a custom JUnitStatementthat checks whether a test class or test method is enabled in the current environment via Spring's@IfProfileValueannotation.- Since:
- 4.2
- Author:
- Sam Brannen, Philippe Marschall
- See Also:
evaluate(),IfProfileValue,ProfileValueUtils
Constructor Summary
Constructors Constructor Description ProfileValueChecker(Statement next, Class<?> testClass, Method testMethod)Construct a newProfileValueCheckerstatement.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidevaluate()Determine if the test specified by arguments to the constructor is enabled in the current environment, as configured via the@IfProfileValueannotation.
Constructor Detail
ProfileValueChecker
public ProfileValueChecker(Statement next, Class<?> testClass, Method testMethod)
Construct a newProfileValueCheckerstatement.- Parameters:
next- the nextStatementin the execution chain; nevernulltestClass- the test class to check; nevernulltestMethod- the test method to check; may benullif thisProfileValueCheckeris being applied at the class level
Method Detail
evaluate
public void evaluate() throws Throwable
Determine if the test specified by arguments to the constructor is enabled in the current environment, as configured via the@IfProfileValueannotation.If the test is not annotated with
@IfProfileValueit is considered enabled.If a test is not enabled, this method will abort further evaluation of the execution chain with a failed assumption; otherwise, this method will simply evaluate the next
Statementin the execution chain.- Specified by:
evaluatein classStatement- Throws:
AssumptionViolatedException- if the test is disabledThrowable- if evaluation of the next statement fails- See Also:
ProfileValueUtils.isTestEnabledInThisEnvironment(Class),ProfileValueUtils.isTestEnabledInThisEnvironment(Method, Class)