Class DefaultArgumentConverter
java.lang.Object
org.junit.jupiter.params.converter.DefaultArgumentConverter
- All Implemented Interfaces:
ArgumentConverter
@API(status=INTERNAL,
since="5.0")
public class DefaultArgumentConverter
extends Object
implements ArgumentConverter
DefaultArgumentConverter
is the default implementation of the
ArgumentConverter
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 the
java.time
package, and some additional common Java types such as
File
, 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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DefaultArgumentConverter
private static final List
<StringToObjectConverter> -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
INSTANCE
-
stringToObjectConverters
-
-
Constructor Details
-
DefaultArgumentConverter
private DefaultArgumentConverter()
-
-
Method Details
-
convert
public final Object convert(Object source, org.junit.jupiter.api.extension.ParameterContext context) 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
-
convert
-
toWrapperType
-