DefaultArgumentConverter, SimpleArgumentConverter@API(status=EXPERIMENTAL, since="5.0") public interface ArgumentConverter
ArgumentConverter is an abstraction that allows an input object to
be converted to an instance of a different class.
Such an ArgumentConverter is applied to the method parameter
of a @ParameterizedTest
method with the help of a
@ConvertWith annotation.
See SimpleArgumentConverter in case your implementation only needs
to know about the target type instead of the complete
ParameterContext.
Implementations must provide a no-args constructor.
SimpleArgumentConverter,
ParameterizedTest,
ConvertWith| Modifier and Type | Method | Description |
|---|---|---|
java.lang.Object |
convert(java.lang.Object source,
ParameterContext context) |
Convert the supplied
source object according to the supplied
context. |
java.lang.Object convert(java.lang.Object source,
ParameterContext context)
throws ArgumentConversionException
source object according to the supplied
context.source - the source object to convert; may be nullcontext - the parameter context where the converted object will be
used; never nullnull but only if the target
type is a reference typeArgumentConversionException - if an error occurs during the
conversion