Annotation Interface ValueSource


@Target({ANNOTATION_TYPE,METHOD}) @Retention(RUNTIME) @Documented @API(status=STABLE, since="5.7") @ArgumentsSource(org.junit.jupiter.params.provider.ValueArgumentsProvider.class) public @interface ValueSource
@ValueSource is an ArgumentsSource which provides access to an array of literal values.

Supported types include shorts(), bytes(), ints(), longs(), floats(), doubles(), chars(), booleans(), strings(), and classes(). Note, however, that only one of the supported types may be specified per @ValueSource declaration.

The supplied literal values will be provided as arguments to the annotated @ParameterizedTest method.

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

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean[]
    The boolean values to use as sources of arguments; must not be empty.
    byte[]
    The byte values to use as sources of arguments; must not be empty.
    char[]
    The char values to use as sources of arguments; must not be empty.
    Class<?>[]
    The Class values to use as sources of arguments; must not be empty.
    double[]
    The double values to use as sources of arguments; must not be empty.
    float[]
    The float values to use as sources of arguments; must not be empty.
    int[]
    The int values to use as sources of arguments; must not be empty.
    long[]
    The long values to use as sources of arguments; must not be empty.
    short[]
    The short values to use as sources of arguments; must not be empty.
    The String values to use as sources of arguments; must not be empty.
  • Element Details

    • shorts

      short[] shorts
      The short values to use as sources of arguments; must not be empty.
      Since:
      5.1
      Default:
      {}
    • bytes

      byte[] bytes
      The byte values to use as sources of arguments; must not be empty.
      Since:
      5.1
      Default:
      {}
    • ints

      int[] ints
      The int values to use as sources of arguments; must not be empty.
      Default:
      {}
    • longs

      long[] longs
      The long values to use as sources of arguments; must not be empty.
      Default:
      {}
    • floats

      float[] floats
      The float values to use as sources of arguments; must not be empty.
      Since:
      5.1
      Default:
      {}
    • doubles

      double[] doubles
      The double values to use as sources of arguments; must not be empty.
      Default:
      {}
    • chars

      char[] chars
      The char values to use as sources of arguments; must not be empty.
      Since:
      5.1
      Default:
      {}
    • booleans

      boolean[] booleans
      The boolean values to use as sources of arguments; must not be empty.
      Since:
      5.5
      Default:
      {}
    • strings

      String[] strings
      The String values to use as sources of arguments; must not be empty.
      Default:
      {}
    • classes

      Class<?>[] classes
      The Class values to use as sources of arguments; must not be empty.
      Since:
      5.1
      Default:
      {}