-
@Target(METHOD) @Retention(RUNTIME) @Repeatable(DisableIfArguments.class) @ExtendWith(DisableIfArgumentExtension.class) public @interface DisableIfArgument
@DisableIfArgumentis a JUnit Jupiter extension that selectively disables aParameterizedTestexecution if the specified argument (as defined byObject.toString()) satisfies the specified condition.The extension uses Jupiter's
InvocationInterceptor. It's important to note that since it's marked asorg.apiguardian.api.API.Status#EXPERIMENTALit might be removed without prior notice. UnlikeDisabledannotations, this extension doesn't disable the whole test method. WithDisableIfArgument, it is possible to selectively disable tests out of the plethora of dynamically registered parameterized tests.The extension requires that exactly one of
containsormatchesis 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:
DisableIfArgumentExtension
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.String[]containsDisable test cases whose argument (converted to String withObject.toString()) contains any of the specified strings (according toString.contains(CharSequence)).intindexThe index of the parameter the extension checks, starting from 0.java.lang.String[]matchesDisable test cases whose argument (converted to String withObject.toString()) matches any of the specified regular expressions (according toString.matches(String)).java.lang.StringnameThe name of the parameter the extension checks.
-