Annotation Type DisableIfArgument
@DisableIfArgument is a JUnit Jupiter extension that selectively disables a
ParameterizedTest execution if the specified
argument (as defined by Object.toString()) satisfies the specified condition.
The extension uses Jupiter's InvocationInterceptor.
It's important to note that since it's marked as
invalid reference
org.apiguardian.api.API.Status#EXPERIMENTALDisabled annotations, this extension doesn't disable the whole test method.
With DisableIfArgument, it is possible to selectively disable tests out of the plethora
of dynamically registered parameterized tests.
The extension requires that exactly one of contains or
matches is configured.
This annotation is for disabling a test based on a single argument which can be designated with an implicit index, an explicit index or by name (if parameter name information is present). For more information how the extension resolves the annotations, check the documentation on disabling parameterized tests.
- Since:
- 1.5.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceContaining annotation of repeatableDisableIfArgument. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionString[]Disable test cases whose argument (converted to String withObject.toString()) contains any of the specified strings (according toString.contains(CharSequence)).intThe index of the parameter the extension checks, starting from 0.String[]Disable test cases whose argument (converted to String withObject.toString()) matches any of the specified regular expressions (according toString.matches(String)).The name of the parameter the extension checks.
-
Element Details
-
name
String nameThe name of the parameter the extension checks. If parameter naming information is not present at runtime, setting this will throwParameterResolutionException.- Default:
""
-
index
int indexThe index of the parameter the extension checks, starting from 0. Negative values are ignored. Setting this to a number higher than the parameter count of the test method will result inExtensionConfigurationException.- Default:
-1
-
contains
String[] containsDisable test cases whose argument (converted to String withObject.toString()) contains any of the specified strings (according toString.contains(CharSequence)).- Default:
{}
-
matches
String[] matchesDisable test cases whose argument (converted to String withObject.toString()) matches any of the specified regular expressions (according toString.matches(String)).- Default:
{}
-