Top Description Inners Methods
org.junit.jupiter.params.provider

public Interface Arguments

Known Direct Implementers
org.junit.jupiter.params.provider.Arguments.ArgumentSet
Annotations
@FunctionalInterface
@API
status:STABLE
since:5.7
Static Imports
org.apiguardian.api.API.Status.MAINTAINED, .API.Status.STABLE

Arguments is an abstraction that provides access to an array of objects to be used for invoking a @ParameterizedTest method.

A java.util.stream.Stream of such Arguments will typically be provided by an ArgumentsProvider.

API Note

This interface is specifically designed as a simple holder of arguments for a parameterized test. Therefore, if you end up transforming or filtering the arguments, you should consider using one of the following in intermediate steps:

Alternatively, you can use an ArgumentConverter to convert some of the arguments from one type to another.

Since
5.0
See Also
ArgumentSet, org.junit.jupiter.params.ParameterizedTest, org.junit.jupiter.params.provider.ArgumentsSource, org.junit.jupiter.params.provider.ArgumentsProvider, org.junit.jupiter.params.converter.ArgumentConverter

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Arguments.ArgumentSet

Specialization of Arguments that associates a name with a set of arguments.

Method Summary

Modifier and TypeMethod and Description
public static Arguments

Returns:

an instance of Arguments; never null
arguments
(@Nullable Object...
the arguments to be used for an invocation of the test method; must not be null but may contain null
arguments
)

Factory method for creating an instance of Arguments based on the supplied arguments.

public static Arguments.ArgumentSet

Returns:

an ArgumentSet; never null
argumentSet
(String
the name of the argument set; must not be null or blank
name
,
@Nullable Object...
the arguments to be used for an invocation of the test method; must not be null but may contain null
arguments
)

Factory method for creating an ArgumentSet based on the supplied name and arguments.

public @Nullable Object[]

Returns:

the arguments; never null but may contain null
get
()

Get the arguments used for an invocation of the @ParameterizedTest method.

public static Arguments

Returns:

an instance of Arguments; never null
of
(@Nullable Object...
the arguments to be used for an invocation of the test method; must not be null but may contain null
arguments
)

Factory method for creating an instance of Arguments based on the supplied arguments.

Method Detail

argumentsback to summary
public static Arguments arguments(@Nullable Object... arguments)

Factory method for creating an instance of Arguments based on the supplied arguments.

This method is an alias for Arguments#of and is intended to be used when statically imported — for example, via: import static org.junit.jupiter.params.provider.Arguments.arguments;

Parameters
arguments:@Nullable Object[]

the arguments to be used for an invocation of the test method; must not be null but may contain null

Returns:Arguments

an instance of Arguments; never null

Since
5.3
See Also
argumentSet(String, Object...)
argumentSetback to summary
public static Arguments.ArgumentSet argumentSet(String name, @Nullable Object... arguments)

Factory method for creating an ArgumentSet based on the supplied name and arguments.

Favor this method over Arguments.of(...) and arguments(...) when you wish to assign a name to the entire set of arguments.

This method is well suited to be used as a static import — for example, via: import static org.junit.jupiter.params.provider.Arguments.argumentSet;.

Parameters
name:String

the name of the argument set; must not be null or blank

arguments:@Nullable Object[]

the arguments to be used for an invocation of the test method; must not be null but may contain null

Returns:Arguments.ArgumentSet

an ArgumentSet; never null

Annotations
@API
status:MAINTAINED
since:5.13.3
Since
5.11
See Also
ArgumentSet, org.junit.jupiter.params.ParameterizedTest#ARGUMENT_SET_NAME_PLACEHOLDER, org.junit.jupiter.params.ParameterizedTest#ARGUMENT_SET_NAME_OR_ARGUMENTS_WITH_NAMES_PLACEHOLDER
getback to summary
public @Nullable Object[] get()

Get the arguments used for an invocation of the @ParameterizedTest method.

API Note

If you need a type-safe way to access some or all of the arguments, please read the class-level API note.

Returns:@Nullable Object[]

the arguments; never null but may contain null

ofback to summary
public static Arguments of(@Nullable Object... arguments)

Factory method for creating an instance of Arguments based on the supplied arguments.

Parameters
arguments:@Nullable Object[]

the arguments to be used for an invocation of the test method; must not be null but may contain null

Returns:Arguments

an instance of Arguments; never null

See Also
arguments(Object...), argumentSet(String, Object...)
org.junit.jupiter.params.provider back to summary

public final Class Arguments.ArgumentSet

extends Object
implements Arguments
Class Inheritance
All Implemented Interfaces
org.junit.jupiter.params.provider.Arguments
Annotations
@API
status:MAINTAINED
since:5.13.3

Specialization of Arguments that associates a name with a set of arguments.
Since
5.11
See Also
Arguments#argumentSet(String, Object...), org.junit.jupiter.params.ParameterizedTest#ARGUMENT_SET_NAME_PLACEHOLDER, org.junit.jupiter.params.ParameterizedTest#ARGUMENT_SET_NAME_OR_ARGUMENTS_WITH_NAMES_PLACEHOLDER

Field Summary

Modifier and TypeField and Description
private final @Nullable Object[]
private final String

Constructor Summary

AccessConstructor and Description
private
ArgumentSet(String name, @Nullable Object[] arguments)

Method Summary

Modifier and TypeMethod and Description
public @Nullable Object[]
get()

Implements org.junit.jupiter.params.provider.Arguments.get.

Get the arguments used for an invocation of the @ParameterizedTest method.

public String

Returns:

the name of this ArgumentSet; never null or blank
getName
()

Get the name of this ArgumentSet.

public String

Returns:

the name of this ArgumentSet
toString
()

Overrides java.lang.Object.toString.

Return the name of this ArgumentSet.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

argumentsback to summary
private final @Nullable Object[] arguments
nameback to summary
private final String name

Constructor Detail

ArgumentSetback to summary
private ArgumentSet(String name, @Nullable Object[] arguments)

Method Detail

getback to summary
public @Nullable Object[] get()

Implements org.junit.jupiter.params.provider.Arguments.get.

Doc from org.junit.jupiter.params.provider.Arguments.get.

Get the arguments used for an invocation of the @ParameterizedTest method.

Annotations
@Override
getNameback to summary
public String getName()

Get the name of this ArgumentSet.

Returns:String

the name of this ArgumentSet; never null or blank

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Return the name of this ArgumentSet.

Returns:String

the name of this ArgumentSet

Annotations
@Override