spring-framework / org.springframework.test.context.junit.jupiter / DisabledIf / <init>

<init>

DisabledIf(value: String, expression: String, reason: String, loadContext: Boolean)

@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