Class CsvArgumentsProvider
- java.lang.Object
-
- org.junit.jupiter.params.provider.AnnotationBasedArgumentsProvider<CsvSource>
-
- org.junit.jupiter.params.provider.CsvArgumentsProvider
-
- All Implemented Interfaces:
java.util.function.Consumer<CsvSource>,ArgumentsProvider,AnnotationConsumer<CsvSource>
class CsvArgumentsProvider extends AnnotationBasedArgumentsProvider<CsvSource>
- Since:
- 5.0
-
-
Field Summary
Fields Modifier and Type Field Description private com.univocity.parsers.csv.CsvParsercsvParserprivate static java.lang.StringLINE_SEPARATORprivate java.util.Set<java.lang.String>nullValues
-
Constructor Summary
Constructors Constructor Description CsvArgumentsProvider()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static java.lang.String[]getHeaders(com.univocity.parsers.csv.CsvParser csvParser)(package private) static java.lang.RuntimeExceptionhandleCsvException(java.lang.Throwable throwable, java.lang.annotation.Annotation annotation)private java.util.stream.Stream<Arguments>parseTextBlock(CsvSource csvSource)private java.util.stream.Stream<Arguments>parseValueArray(CsvSource csvSource)(package private) static ArgumentsprocessCsvRecord(java.lang.Object[] csvRecord, java.util.Set<java.lang.String> nullValues, boolean useHeadersInDisplayName, java.lang.String[] headers)Processes custom null values, supports wrapping of column values inNamedif necessary (for CSV header support), and returns the CSV record wrapped in anArgumentsinstance.protected java.util.stream.Stream<? extends Arguments>provideArguments(ParameterDeclarations parameters, org.junit.jupiter.api.extension.ExtensionContext context, CsvSource csvSource)The returnedStreamwill beproperly closedby the default implementation ofAnnotationBasedArgumentsProvider.provideArguments(ParameterDeclarations, ExtensionContext), making it safe to use a resource such asFiles.lines().-
Methods inherited from class org.junit.jupiter.params.provider.AnnotationBasedArgumentsProvider
accept, provideArguments, provideArguments
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.junit.jupiter.params.provider.ArgumentsProvider
provideArguments
-
-
-
-
Field Detail
-
LINE_SEPARATOR
private static final java.lang.String LINE_SEPARATOR
- See Also:
- Constant Field Values
-
nullValues
private java.util.Set<java.lang.String> nullValues
-
csvParser
private com.univocity.parsers.csv.CsvParser csvParser
-
-
Method Detail
-
provideArguments
protected java.util.stream.Stream<? extends Arguments> provideArguments(ParameterDeclarations parameters, org.junit.jupiter.api.extension.ExtensionContext context, CsvSource csvSource)
Description copied from class:AnnotationBasedArgumentsProviderThe returnedStreamwill beproperly closedby the default implementation ofAnnotationBasedArgumentsProvider.provideArguments(ParameterDeclarations, ExtensionContext), making it safe to use a resource such asFiles.lines().- Overrides:
provideArgumentsin classAnnotationBasedArgumentsProvider<CsvSource>
-
getHeaders
static java.lang.String[] getHeaders(com.univocity.parsers.csv.CsvParser csvParser)
-
processCsvRecord
static Arguments processCsvRecord(java.lang.Object[] csvRecord, java.util.Set<java.lang.String> nullValues, boolean useHeadersInDisplayName, java.lang.String[] headers)
Processes custom null values, supports wrapping of column values inNamedif necessary (for CSV header support), and returns the CSV record wrapped in anArgumentsinstance.
-
handleCsvException
static java.lang.RuntimeException handleCsvException(java.lang.Throwable throwable, java.lang.annotation.Annotation annotation)- Returns:
- this method always throws an exception and therefore never
returns anything; the return type is merely present to allow this
method to be supplied as the operand in a
throwstatement
-
-