@Target([AnnotationTarget.CLASS, AnnotationTarget.FILE, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER]) @ExtendWith(DisabledIfCondition) class DisabledIf
@DisabledIf is used to signal that the annotated test class or test method is disabled and should not be executed if the supplied #expression evaluates to true.
When applied at the class level, all test methods within that class are automatically disabled as well.
For basic examples, see the Javadoc for #expression.
This annotation may be used as a meta-annotation to create custom composed annotations. For example, a custom @DisabledOnMac annotation can be created as follows.
@Target({ ElementType.TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @DisabledIf( expression = "#{systemProperties['os.name'].toLowerCase().contains('mac')}", reason = "Disabled on Mac OS" ) public @interface DisabledOnMac {}
Author
Sam Brannen
Author
Tadaya Tsuyukubo
Since
5.0
See Also
SpringExtensionEnabledIforg.junit.jupiter.api.Disabled
DisabledIf(value: String, expression: String, reason: String, loadContext: Boolean)
When applied at the class level, all test methods within that class are automatically disabled as well. For basic examples, see the Javadoc for This annotation may be used as a meta-annotation to create custom composed annotations. For example, a custom
|
val expression: String
The expression that will be evaluated to determine if the annotated test class or test method is disabled. If the expression evaluates to Expressions can be any of the following.
Note, however, that a text literal which is not the result of dynamic resolution of a property placeholder is of zero practical value since |
|
val loadContext: Boolean
Whether the Defaults to |
|
val reason: String
The reason this test is disabled. |
|
val value: String
Alias for |