Class ArgumentSets

java.lang.Object
org.junitpioneer.jupiter.cartesian.ArgumentSets

public class ArgumentSets extends Object
Class for defining sets to a CartesianTest execution with arguments for each parameter in the order in which they appear in the test method.

Use the static factory method argumentsForFirstParameter to create an instance and call argumentsForNextParameter for each parameter after the first. Alternatively, call the static factory method create to create an instance call argumentsForNextParameter for each parameter.

  • Field Details

    • arguments

      private final List<List<?>> arguments
  • Constructor Details

    • ArgumentSets

      private ArgumentSets()
    • ArgumentSets

      private ArgumentSets(Collection<?> arguments)
  • Method Details

    • add

      private ArgumentSets add(Collection<?> arguments)
    • create

      public static ArgumentSets create()
      Creates a new ArgumentSets without arguments for any parameters.
    • argumentsForFirstParameter

      public static <T> ArgumentSets argumentsForFirstParameter(Collection<T> arguments)
      Creates a single set of distinct objects (according to their equals) for the first parameter of a CartesianTest from the elements of the passed Collection.

      The passed argument does not have to be an instance of Set.

      Parameters:
      arguments - the objects that should be passed to the parameter
      Returns:
      a new ArgumentSets object
    • argumentsForFirstParameter

      @SafeVarargs public static <T> ArgumentSets argumentsForFirstParameter(T... arguments)
      Creates a single set of distinct objects (according to their equals) for the first parameter of a CartesianTest from the elements of the passed objects.
      Parameters:
      arguments - the objects that should be passed to the parameter
      Returns:
      a new ArgumentSets object
    • argumentsForFirstParameter

      public static <T> ArgumentSets argumentsForFirstParameter(Stream<T> arguments)
      Creates a single set of distinct objects (according to their equals) for the first parameter of a CartesianTest from the elements of the passed Stream.
      Parameters:
      arguments - the objects that should be passed to the parameter
      Returns:
      a new ArgumentSets object
    • argumentsForNextParameter

      public final <T> ArgumentSets argumentsForNextParameter(Collection<T> arguments)
      Creates a single set of distinct objects (according to their equals) for the next parameter of a CartesianTest from the elements of the passed Collection.

      The passed argument does not have to be an instance of Set.

      Parameters:
      arguments - the objects that should be passed to the parameter
      Returns:
      this ArgumentSets object, for fluent set definitions
    • argumentsForNextParameter

      @SafeVarargs public final <T> ArgumentSets argumentsForNextParameter(T... arguments)
      Creates a single set of distinct objects (according to their equals) for the next parameter of a CartesianTest from the elements of the passed objects.
      Parameters:
      arguments - the objects that should be passed to the parameter
      Returns:
      this ArgumentSets object, for fluent set definitions
    • argumentsForNextParameter

      public final <T> ArgumentSets argumentsForNextParameter(Stream<T> arguments)
      Creates a single set of distinct objects (according to their equals) for the next parameter of a CartesianTest from the elements of the passed Stream.
      Parameters:
      arguments - the objects that should be passed to the parameter
      Returns:
      this ArgumentSets object, for fluent set definitions
    • getArguments

      List<List<?>> getArguments()