Annotation Type EnumSource



  • @Target({ANNOTATION_TYPE,METHOD})
    @Retention(RUNTIME)
    @Documented
    @API(status=EXPERIMENTAL,
         since="5.0")
    @ArgumentsSource(org.junit.jupiter.params.provider.EnumArgumentsProvider.class)
    public @interface EnumSource
    @EnumSource is an ArgumentsSource for constants of a specified Enum.

    The enum constants will be provided as arguments to the annotated @ParameterizedTest method.

    The set of enum constants can be restricted by listing the desired values via the names() attribute.

    Since:
    5.0
    See Also:
    ArgumentsSource, ParameterizedTest
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      java.lang.Class<? extends java.lang.Enum<?>> value
      The enum type that serves as the source of the enum constants.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element 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.
    • Element Detail

      • value

        java.lang.Class<? extends java.lang.Enum<?>> value
        The enum type that serves as the source of the enum constants.
        See Also:
        names(), mode()
      • names

        java.lang.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, all enum constants declared in the specified enum type will be provided.

        The mode() determines how the names are interpreted.

        See Also:
        value(), mode()
        Default:
        {}
      • mode

        EnumSource.Mode mode
        The enum constant selection mode.

        Defaults to INCLUDE.

        See Also:
        names()
        Default:
        org.junit.jupiter.params.provider.EnumSource.Mode.INCLUDE