Class SimpleArgumentConverter
- java.lang.Object
-
- org.junit.jupiter.params.converter.SimpleArgumentConverter
-
- All Implemented Interfaces:
ArgumentConverter
- Direct Known Subclasses:
DefaultArgumentConverter
@API(status=EXPERIMENTAL, since="5.0") public abstract class SimpleArgumentConverter extends Object implements ArgumentConverter
SimpleArgumentConverter
is an abstract base class forArgumentConverter
implementations.- Since:
- 5.0
- See Also:
ArgumentConverter
-
-
Constructor Summary
Constructors Constructor Description SimpleArgumentConverter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Object
convert(Object source, Class<?> targetType)
Convert the suppliedsource
object into to the suppliedtargetType
.Object
convert(Object source, ParameterContext context)
Convert the suppliedsource
object according to the suppliedcontext
.
-
-
-
Method Detail
-
convert
public final Object convert(Object source, ParameterContext context) throws ArgumentConversionException
Description copied from interface:ArgumentConverter
Convert the suppliedsource
object according to the suppliedcontext
.- Specified by:
convert
in interfaceArgumentConverter
- Parameters:
source
- the source object to convert; may benull
context
- the parameter context where the converted object will be used; nevernull
- Returns:
- the converted object; may be
null
but only if the target type is a reference type - Throws:
ArgumentConversionException
- if an error occurs during the conversion
-
convert
protected abstract Object convert(Object source, Class<?> targetType) throws ArgumentConversionException
Convert the suppliedsource
object into to the suppliedtargetType
.- Parameters:
source
- the source object to convert; may benull
targetType
- the target type the source object should be converted into; nevernull
- Returns:
- the converted object; may be
null
but only if the target type is a reference type. - Throws:
ArgumentConversionException
- in case an error occurs during the conversion.
-
-