Class SimpleArgumentConverter
- java.lang.Object
-
- org.junit.jupiter.params.converter.SimpleArgumentConverter
-
- All Implemented Interfaces:
ArgumentConverter
@API(status=STABLE, since="5.7") public abstract class SimpleArgumentConverter extends java.lang.Object implements ArgumentConverterSimpleArgumentConverteris an abstract base class forArgumentConverterimplementations that only need to know the target type and do not need access to theParameterContextto perform the conversion.- Since:
- 5.0
- See Also:
ArgumentConverter,TypedArgumentConverter
-
-
Constructor Summary
Constructors Constructor Description SimpleArgumentConverter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.lang.Objectconvert(java.lang.Object source, java.lang.Class<?> targetType)Convert the suppliedsourceobject into the suppliedtargetType.java.lang.Objectconvert(java.lang.Object source, org.junit.jupiter.api.extension.ParameterContext context)Convert the suppliedsourceobject according to the suppliedcontext.java.lang.Objectconvert(java.lang.Object source, FieldContext context)Convert the suppliedsourceobject according to the suppliedcontext.
-
-
-
Method Detail
-
convert
public final java.lang.Object convert(java.lang.Object source, org.junit.jupiter.api.extension.ParameterContext context) throws ArgumentConversionExceptionDescription copied from interface:ArgumentConverterConvert the suppliedsourceobject according to the suppliedcontext.- Specified by:
convertin interfaceArgumentConverter- Parameters:
source- the source object to convert; may benullcontext- the parameter context where the converted object will be supplied; 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
-
convert
public final java.lang.Object convert(java.lang.Object source, FieldContext context) throws ArgumentConversionExceptionDescription copied from interface:ArgumentConverterConvert the suppliedsourceobject according to the suppliedcontext.- Specified by:
convertin interfaceArgumentConverter- Parameters:
source- the source object to convert; may benullcontext- the field context where the converted object will be injected; 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
-
convert
protected abstract java.lang.Object convert(java.lang.Object source, java.lang.Class<?> targetType) throws ArgumentConversionExceptionConvert the suppliedsourceobject into the suppliedtargetType.- Parameters:
source- the source object to convert; may benulltargetType- the target type the source object should be converted into; nevernull- Returns:
- the converted object; may be
nullbut only if the target type is a reference type - Throws:
ArgumentConversionException- in case an error occurs during the conversion
-
-