Interface ArgumentConverter
-
- All Known Implementing Classes:
DefaultArgumentConverter,SimpleArgumentConverter
@API(status=EXPERIMENTAL, since="5.0") public interface ArgumentConverter
ArgumentConverteris an abstraction that allows an input object to be converted to an instance of a different class.Such an
ArgumentConverteris applied to the method parameter of a@ParameterizedTestmethod with the help of a@ConvertWithannotation.See
SimpleArgumentConverterin case your implementation only needs to know about the target type instead of the completeParameterContext.Implementations must provide a no-args constructor.
- Since:
- 5.0
- See Also:
SimpleArgumentConverter,ParameterizedTest,ConvertWith
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Objectconvert(Object source, ParameterContext context)Convert the suppliedsourceobject according to the suppliedcontext.
-
-
-
Method Detail
-
convert
Object convert(Object source, ParameterContext context) throws ArgumentConversionException
Convert the suppliedsourceobject according to the suppliedcontext.- Parameters:
source- the source object to convert; may benullcontext- the parameter context where the converted object will be used; nevernull- Returns:
- the converted object; may be
nullbut only if the target type is a reference type - Throws:
ArgumentConversionException- if an error occurs during the conversion
-
-