Module org.junit.jupiter.params
Class DefaultArgumentsAccessor
java.lang.Object
org.junit.jupiter.params.aggregator.DefaultArgumentsAccessor
- All Implemented Interfaces:
ArgumentsAccessor
@API(status=INTERNAL,
since="5.2")
public class DefaultArgumentsAccessor
extends Object
implements ArgumentsAccessor
Default implementation of the
ArgumentsAccessor
API.
Delegates conversion to DefaultArgumentConverter
.
- Since:
- 5.2
- See Also:
ArgumentsAccessor
,DefaultArgumentConverter
,ParameterizedTest
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionget(int index)
Get the value of the argument at the given index as anObject
.<T> T
Get the value of the argument at the given index as an instance of the required type.getBoolean(int index)
Get the value of the argument at the given index as aBoolean
, performing automatic type conversion as necessary.getByte(int index)
Get the value of the argument at the given index as aByte
, performing automatic type conversion as necessary.getCharacter(int index)
Get the value of the argument at the given index as aCharacter
, performing automatic type conversion as necessary.getDouble(int index)
Get the value of the argument at the given index as aDouble
, performing automatic type conversion as necessary.getFloat(int index)
Get the value of the argument at the given index as aFloat
, performing automatic type conversion as necessary.getInteger(int index)
Get the value of the argument at the given index as aInteger
, performing automatic type conversion as necessary.getLong(int index)
Get the value of the argument at the given index as aLong
, performing automatic type conversion as necessary.getShort(int index)
Get the value of the argument at the given index as aShort
, performing automatic type conversion as necessary.getString(int index)
Get the value of the argument at the given index as aString
, performing automatic type conversion as necessary.int
size()
Get the number of arguments in this accessor.Object[]
toArray()
Get all arguments in this accessor as an array.toList()
Get all arguments in this accessor as an immutable list.
-
Constructor Details
-
DefaultArgumentsAccessor
-
-
Method Details
-
get
Description copied from interface:ArgumentsAccessor
Get the value of the argument at the given index as anObject
.- Specified by:
get
in interfaceArgumentsAccessor
- Parameters:
index
- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()
- Returns:
- the value at the given index, potentially
null
-
get
Description copied from interface:ArgumentsAccessor
Get the value of the argument at the given index as an instance of the required type.- Specified by:
get
in interfaceArgumentsAccessor
- Parameters:
index
- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()
requiredType
- the required type of the value; nevernull
- Returns:
- the value at the given index, potentially
null
-
getCharacter
Description copied from interface:ArgumentsAccessor
Get the value of the argument at the given index as aCharacter
, performing automatic type conversion as necessary.- Specified by:
getCharacter
in interfaceArgumentsAccessor
- Parameters:
index
- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()
- Returns:
- the value at the given index, potentially
null
-
getBoolean
Description copied from interface:ArgumentsAccessor
Get the value of the argument at the given index as aBoolean
, performing automatic type conversion as necessary.- Specified by:
getBoolean
in interfaceArgumentsAccessor
- Parameters:
index
- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()
- Returns:
- the value at the given index, potentially
null
-
getByte
Description copied from interface:ArgumentsAccessor
Get the value of the argument at the given index as aByte
, performing automatic type conversion as necessary.- Specified by:
getByte
in interfaceArgumentsAccessor
- Parameters:
index
- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()
- Returns:
- the value at the given index, potentially
null
-
getShort
Description copied from interface:ArgumentsAccessor
Get the value of the argument at the given index as aShort
, performing automatic type conversion as necessary.- Specified by:
getShort
in interfaceArgumentsAccessor
- Parameters:
index
- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()
- Returns:
- the value at the given index, potentially
null
-
getInteger
Description copied from interface:ArgumentsAccessor
Get the value of the argument at the given index as aInteger
, performing automatic type conversion as necessary.- Specified by:
getInteger
in interfaceArgumentsAccessor
- Parameters:
index
- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()
- Returns:
- the value at the given index, potentially
null
-
getLong
Description copied from interface:ArgumentsAccessor
Get the value of the argument at the given index as aLong
, performing automatic type conversion as necessary.- Specified by:
getLong
in interfaceArgumentsAccessor
- Parameters:
index
- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()
- Returns:
- the value at the given index, potentially
null
-
getFloat
Description copied from interface:ArgumentsAccessor
Get the value of the argument at the given index as aFloat
, performing automatic type conversion as necessary.- Specified by:
getFloat
in interfaceArgumentsAccessor
- Parameters:
index
- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()
- Returns:
- the value at the given index, potentially
null
-
getDouble
Description copied from interface:ArgumentsAccessor
Get the value of the argument at the given index as aDouble
, performing automatic type conversion as necessary.- Specified by:
getDouble
in interfaceArgumentsAccessor
- Parameters:
index
- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()
- Returns:
- the value at the given index, potentially
null
-
getString
Description copied from interface:ArgumentsAccessor
Get the value of the argument at the given index as aString
, performing automatic type conversion as necessary.- Specified by:
getString
in interfaceArgumentsAccessor
- Parameters:
index
- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()
- Returns:
- the value at the given index, potentially
null
-
size
public int size()Description copied from interface:ArgumentsAccessor
Get the number of arguments in this accessor.- Specified by:
size
in interfaceArgumentsAccessor
-
toArray
Description copied from interface:ArgumentsAccessor
Get all arguments in this accessor as an array.- Specified by:
toArray
in interfaceArgumentsAccessor
-
toList
Description copied from interface:ArgumentsAccessor
Get all arguments in this accessor as an immutable list.- Specified by:
toList
in interfaceArgumentsAccessor
-