Interface ArgumentsAggregator
-
@API(status=EXPERIMENTAL, since="5.2") public interface ArgumentsAggregator
ArgumentsAggregator
is an abstraction for the aggregation of arguments provided by anArgumentsProvider
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 and 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 and designed to be used as singletons.
- Since:
- 5.2
- See Also:
AggregateWith
,ArgumentsAccessor
,ParameterizedTest
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Object
aggregateArguments(ArgumentsAccessor accessor, ParameterContext context)
Aggregate the arguments contained in the suppliedaccessor
into a single object.
-
-
-
Method Detail
-
aggregateArguments
Object aggregateArguments(ArgumentsAccessor accessor, ParameterContext context) throws ArgumentsAggregationException
Aggregate the arguments contained in the suppliedaccessor
into a single object.- Parameters:
accessor
- anArgumentsAccessor
containing the arguments to be aggregated; nevernull
context
- the parameter context where the aggregated result is to be supplied; nevernull
- Returns:
- the aggregated result; may be
null
but only if the target type is a reference type - Throws:
ArgumentsAggregationException
- if an error occurs during the aggregation
-
-