Class DefaultArgumentConverter
- java.lang.Object
-
- org.junit.jupiter.params.converter.SimpleArgumentConverter
-
- org.junit.jupiter.params.converter.DefaultArgumentConverter
-
- All Implemented Interfaces:
ArgumentConverter
@API(status=INTERNAL, since="5.0") public class DefaultArgumentConverter extends SimpleArgumentConverter
DefaultArgumentConverter
is the default implementation of theArgumentConverter
API.The
DefaultArgumentConverter
is able to convert from strings to a number of primitive types and their corresponding wrapper types (Byte, Short, Integer, Long, Float, and Double), date and time types from thejava.time
package, and some additional common Java types such asFile
,BigDecimal
,BigInteger
,Currency
,Locale
,URI
,URL
,UUID
, etc.If the source and target types are identical the source object will not be modified.
- Since:
- 5.0
- See Also:
ArgumentConverter
-
-
Field Summary
Fields Modifier and Type Field Description static DefaultArgumentConverter
INSTANCE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Object
convert(java.lang.Object source, java.lang.Class<?> targetType)
Convert the suppliedsource
object into to the suppliedtargetType
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from class org.junit.jupiter.params.converter.SimpleArgumentConverter
convert
-
-
-
-
Field Detail
-
INSTANCE
public static final DefaultArgumentConverter INSTANCE
-
-
Method Detail
-
convert
protected java.lang.Object convert(java.lang.Object source, java.lang.Class<?> targetType)
Description copied from class:SimpleArgumentConverter
Convert the suppliedsource
object into to the suppliedtargetType
.- Specified by:
convert
in classSimpleArgumentConverter
- 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.
-
-