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 java.lang.Object
implements ArgumentConverter
TypedArgumentConverter is an ArgumentConverter that
always converts a given type to another.- Since:
- 5.7
- See Also:
ArgumentConverter
-
Constructor Summary
Constructors Modifier Constructor Description protectedTypedArgumentConverter(java.lang.Class<S> sourceType, java.lang.Class<T> targetType) -
Method Summary
Modifier and Type Method Description java.lang.Objectconvert(java.lang.Object source, org.junit.jupiter.api.extension.ParameterContext context)Convert the suppliedsourceobject according to the suppliedcontext.protected abstract Tconvert(S source)Convert the suppliedsourceobject of type S into an object of type T.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
TypedArgumentConverter
-
-
Method Details
-
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 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
-
convert
Convert the suppliedsourceobject 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
-