@Target(value={ANNOTATION_TYPE,METHOD}) @Retention(value=RUNTIME) @Documented @API(status=EXPERIMENTAL, since="5.0") @ArgumentsSource(value=EnumArgumentsProvider.class) public @interface EnumSource
@EnumSource
is an ArgumentsSource
for constants of a
an Enum
.
The enum constants will be provided as arguments to the annotated
@ParameterizedTest
method.
The enum type can be specified explicitly using the value()
attribute. Otherwise, the declared type of the first parameter of the
@ParameterizedTest
method is used.
The set of enum constants can be restricted via the names()
and
mode()
attributes.
ArgumentsSource
,
ParameterizedTest
Modifier and Type | Optional Element and Description |
---|---|
EnumSource.Mode |
mode
The enum constant selection mode.
|
java.lang.String[] |
names
The names of enum constants to provide, or regular expressions to select
the names of enum constants to provide.
|
java.lang.Class<? extends java.lang.Enum<?>> |
value
The enum type that serves as the source of the enum constants.
|
public abstract java.lang.Class<? extends java.lang.Enum<?>> value
If this attribute is not set explicitly, the declared type of the
first parameter of the @ParameterizedTest
method is used.
public abstract java.lang.String[] names
If no names or regular expressions are specified, all enum constants declared in the specified enum type will be provided.
The mode()
determines how the names are interpreted.
public abstract EnumSource.Mode mode
Defaults to INCLUDE
.
EnumSource.Mode.INCLUDE
,
EnumSource.Mode.EXCLUDE
,
EnumSource.Mode.MATCH_ALL
,
EnumSource.Mode.MATCH_ANY
,
names()