Module org.junit.jupiter.params
Class TypedArgumentConverter<S,T>
- java.lang.Object
-
- org.junit.jupiter.params.converter.TypedArgumentConverter<S,T>
-
- Type Parameters:
S
- the type of the argument to convertT
- the type of the target
- All Implemented Interfaces:
ArgumentConverter
@API(status=EXPERIMENTAL, since="5.7") public abstract class TypedArgumentConverter<S,T> extends Object implements ArgumentConverter
TypedArgumentConverter
is anArgumentConverter
that always converts a given type to another.- Since:
- 5.7
- See Also:
ArgumentConverter
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TypedArgumentConverter(Class<S> sourceType, Class<T> targetType)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Object
convert(Object source, ParameterContext context)
Convert the suppliedsource
object according to the suppliedcontext
.protected abstract T
convert(S source)
Convert the suppliedsource
object of type S into an object of type T.
-
-
-
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 T convert(S source) throws ArgumentConversionException
Convert the suppliedsource
object of type S into an object of type T.- Parameters:
source
- the source object to convert; may benull
- Returns:
- the converted object
- Throws:
ArgumentConversionException
- in case an error occurs during the conversion
-
-