@EnumSource is a repeatable
ArgumentsSource for constants of an Enum.
The enum constants will be provided as arguments to the annotated
@ParameterizedClass or @ParameterizedTest.
The enum type can be specified explicitly using the value
attribute. Otherwise, the declared type of the first parameter of the
@ParameterizedClass or @ParameterizedTest is used.
The set of enum constants can be restricted via the names,
from, to and mode attributes.
This annotation is inherited to subclasses.
org.junit.jupiter.params.provider.ArgumentsSource , org.junit.jupiter.params.ParameterizedClass , org.junit.jupiter.params.ParameterizedTest
| Modifier and Type | Class and Description |
|---|---|
| public static enum | EnumSource.
Enumeration of modes for selecting enum constants by name. |
| Modifier and Type | Method and Description |
|---|---|
| public String | |
| public EnumSource. | |
| public String[] | names()
The names of enum constants to provide, or regular expressions to select the names of enum constants to provide. |
| public String | |
| public Class |
| from | back to summary |
|---|---|
| public String from() The starting enum constant of the range to be included. Defaults to an empty string, where the range starts from the first enum constant of the specified enum type. | |
| mode | back to summary |
|---|---|
| public EnumSource. The enum constant selection mode. The mode only applies to the Defaults to
| |
| names | back to summary |
|---|---|
| public String[] names() The 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, and neither If The | |
| to | back to summary |
|---|---|
| public String to() The ending enum constant of the range to be included. Defaults to an empty string, where the range ends at the last enum constant of the specified enum type. | |
| value | back to summary |
|---|---|
| public Class 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 | |
| Modifier and Type | Class and Description |
|---|---|
| private static interface |
| Modifier and Type | Field and Description |
|---|---|
| public static final EnumSource. | EXCLUDE
Select all declared enum constants except those supplied via the
|
| public static final EnumSource. | INCLUDE
Select only those enum constants whose names are supplied via the
|
| public static final EnumSource. | MATCH_ALL
Select only those enum constants whose names match all patterns supplied
via the |
| public static final EnumSource. | MATCH_ANY
Select only those enum constants whose names match any pattern supplied
via the |
| public static final EnumSource. | MATCH_NONE
Select only those enum constants whose names match none of the patterns supplied
via the |
| private final BiPredicate | |
| private final EnumSource. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv boolean | |
| pack-priv void | |
| private static void | |
| private static void | |
| public static EnumSource. | |
| public static EnumSource. |
| EXCLUDE | back to summary |
|---|---|
| public static final EnumSource. Select all declared enum constants except those supplied via the
| |
| INCLUDE | back to summary |
|---|---|
| public static final EnumSource. Select only those enum constants whose names are supplied via the
| |
| MATCH_ALL | back to summary |
|---|---|
| public static final EnumSource. Select only those enum constants whose names match all patterns supplied
via the | |
| MATCH_ANY | back to summary |
|---|---|
| public static final EnumSource. Select only those enum constants whose names match any pattern supplied
via the | |
| MATCH_NONE | back to summary |
|---|---|
| public static final EnumSource. Select only those enum constants whose names match none of the patterns supplied
via the
| |
| selector | back to summary |
|---|---|
| private final BiPredicate<String, Set<String>> selector | |
| validator | back to summary |
|---|---|
| private final EnumSource. | |
| Mode | back to summary |
|---|---|
| private Mode(EnumSource. | |
| select | back to summary |
|---|---|
| pack-priv boolean select(Enum<?> constant, Set<String> names) | |
| validate | back to summary |
|---|---|
| pack-priv void validate(EnumSource enumSource, Set<? extends Enum<?>> constants, Set<String> names) | |
| validateNames | back to summary |
|---|---|
| private static void validateNames(EnumSource enumSource, Set<? extends Enum<?>> constants, Set<String> names) | |
| validatePatterns | back to summary |
|---|---|
| private static void validatePatterns(EnumSource enumSource, Set<? extends Enum<?>> constants, Set<String> names) | |
| valueOf | back to summary |
|---|---|
| public static EnumSource. | |
| values | back to summary |
|---|---|
| public static EnumSource. | |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| validate | back to summary |
|---|---|
| public void validate(EnumSource enumSource, Set<? extends Enum<?>> constants, Set<String> names) | |