@Documented
@Incubating
@Retention(value=RetentionPolicy.RUNTIME)
@Target(value=[ElementType.TYPE, ElementType.METHOD])
@ExtendWith(value=GroovyConditionExtension)
@interface GroovyEnabledIf
Enables the annotated test class or method if the Groovy closure evaluates to true.
The closure is evaluated with a delegate providing the following bindings:
systemEnvironment — System.getenv()systemProperties — System.getProperties()javaVersion — Runtime Java feature version (e.g. 17, 21)junitTags — tags assigned to the testjunitDisplayName — display name of the testjunitUniqueId — unique ID of the testExample usage:
@Test
@GroovyEnabledIf({ javaVersion >= 21 })
void needsVirtualThreads() { ... }
@Test
@GroovyEnabledIf({ systemEnvironment['CI'] == 'true' })
void onlyOnCI() { ... }