Module org.junit.jupiter.params
Annotation Interface EnumSource
@Target({ANNOTATION_TYPE,METHOD})
@Retention(RUNTIME)
@Documented
@Repeatable(EnumSources.class)
@API(status=STABLE,
since="5.7")
@ArgumentsSource(org.junit.jupiter.params.provider.EnumArgumentsProvider.class)
public @interface EnumSource
@EnumSource
is a repeatable
ArgumentsSource
for constants of 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.
- Since:
- 5.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enumeration of modes for selecting enum constants by name. -
Optional Element Summary
Modifier and TypeOptional ElementDescriptionThe enum constant selection mode.String[]
The names of enum constants to provide, or regular expressions to select the names of enum constants to provide.The enum type that serves as the source of the enum constants.
-
Element Details
-
value
The enum type that serves as the source of the enum constants.If this attribute is not set explicitly, the declared type of the first parameter of the
@ParameterizedTest
method is used.- See Also:
- Default:
org.junit.jupiter.params.provider.NullEnum.class
-
names
String[] namesThe names of enum constants to provide, or regular expressions to select the names of enum constants to provide.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.- See Also:
- Default:
{}
-
mode
EnumSource.Mode modeThe enum constant selection mode.Defaults to
INCLUDE
.- See Also:
- Default:
INCLUDE
-