Top Description Methods
org.junit.jupiter.params.aggregator

public Interface ArgumentsAggregator

Known Direct Implementers
org.junit.jupiter.params.aggregator.SimpleArgumentsAggregator
Annotations
@API
status:STABLE
since:5.7
Static Imports
org.apiguardian.api.API.Status.EXPERIMENTAL, .API.Status.STABLE

ArgumentsAggregator is an abstraction for the aggregation of arguments provided by an ArgumentsProvider for a single invocation of a @ParameterizedTest method into a single object.

An ArgumentsAggregator is applied to a method parameter of a @ParameterizedTest method via the @AggregateWith annotation.

The result of the aggregation will be passed as an argument to the @ParameterizedTest method for the annotated parameter.

A common use case is the aggregation of multiple columns from a single line in a CSV file into a domain object such as a Person, Address, Order, etc.

Implementations must provide a no-args constructor or a single unambiguous constructor to use parameter resolution. They should not make any assumptions regarding when they are instantiated or how often they are called. Since instances may potentially be cached and called from different threads, they should be thread-safe.

Since
5.2
See Also
AggregateWith, ArgumentsAccessor, SimpleArgumentsAggregator, org.junit.jupiter.params.ParameterizedTest

Method Summary

Modifier and TypeMethod and Description
public @Nullable Object

Returns:

the aggregated result; may be null but only if the target type is a reference type
aggregateArguments
(ArgumentsAccessor
an ArgumentsAccessor containing the arguments to be aggregated; never null
accessor
,
ParameterContext
the parameter context where the aggregated result is to be supplied; never null
context
)

Aggregate the arguments contained in the supplied accessor into a single object.

public default @Nullable Object

Returns:

the aggregated result; may be null but only if the target type is a reference type
aggregateArguments
(ArgumentsAccessor
an ArgumentsAccessor containing the arguments to be aggregated; never null
accessor
,
FieldContext
the field context where the aggregated result is to be injected; never null
context
)

Aggregate the arguments contained in the supplied accessor into a single object.

Method Detail

aggregateArgumentsback to summary
public @Nullable Object aggregateArguments(ArgumentsAccessor accessor, ParameterContext context) throws ArgumentsAggregationException

Aggregate the arguments contained in the supplied accessor into a single object.

Parameters
accessor:ArgumentsAccessor

an ArgumentsAccessor containing the arguments to be aggregated; never null

context:ParameterContext

the parameter context where the aggregated result is to be supplied; never null

Returns:@Nullable Object

the aggregated result; may be null but only if the target type is a reference type

Exceptions
ArgumentsAggregationException:
if an error occurs during the aggregation
aggregateArgumentsback to summary
public default @Nullable Object aggregateArguments(ArgumentsAccessor accessor, FieldContext context) throws ArgumentsAggregationException

Aggregate the arguments contained in the supplied accessor into a single object.

Parameters
accessor:ArgumentsAccessor

an ArgumentsAccessor containing the arguments to be aggregated; never null

context:FieldContext

the field context where the aggregated result is to be injected; never null

Returns:@Nullable Object

the aggregated result; may be null but only if the target type is a reference type

Annotations
@API
status:EXPERIMENTAL
since:6.0
Exceptions
ArgumentsAggregationException:
if an error occurs during the aggregation
Since
5.13