Annotation Type LongRangeSource


  • @Target({METHOD,PARAMETER})
    @Retention(RUNTIME)
    @Documented
    @ArgumentsSource(RangeSourceArgumentsProvider.class)
    @Repeatable(LongRangeSources.class)
    public @interface LongRangeSource
    @LongRangeSource is an ArgumentsSource that provides access to a range of long values.

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

    For more details and examples, see the documentation on range sources.

    This annotation is Repeatable, to make it usable with CartesianTest. If used with ParameterizedTest, it can only be used once (because ParameterizedTest can only take a single ArgumentsSource). Using it more than once will throw an IllegalArgumentException. If used with CartesianTest, it can be repeated to provide arguments to more than one parameter.

    This annotation can be used on a method parameter, to make it usable with CartesianTest. If used with ParameterizedTest, the annotation has to be on the method itself as any other ArgumentsSource.

    For more details and examples, see the documentation on Cartesian product tests.

    Since:
    0.5
    See Also:
    ArgumentsSource, ParameterizedTest, CartesianTest, CartesianTest
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      long from
      The starting point of the range, inclusive.
      long to
      The end point of the range, exclusive.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean closed
      Whether the range is closed (inclusive of the to()) or not.
      long step
      The size of the step between the from and the to.
    • Element Detail

      • from

        long from
        The starting point of the range, inclusive.
      • to

        long to
        The end point of the range, exclusive.
      • step

        long step
        The size of the step between the from and the to.
        Default:
        1L
      • closed

        boolean closed
        Whether the range is closed (inclusive of the to()) or not.
        Default:
        false