Class CsvArgumentsProvider

All Implemented Interfaces:
Consumer<CsvSource>, ArgumentsProvider, AnnotationConsumer<CsvSource>

class CsvArgumentsProvider extends AnnotationBasedArgumentsProvider<CsvSource>
Since:
5.0
  • Field Details

    • LINE_SEPARATOR

      private static final String LINE_SEPARATOR
      See Also:
    • nullValues

      private Set<String> nullValues
    • csvParser

      private com.univocity.parsers.csv.CsvParser csvParser
  • Constructor Details

    • CsvArgumentsProvider

      CsvArgumentsProvider()
  • Method Details

    • provideArguments

      protected Stream<? extends Arguments> provideArguments(org.junit.jupiter.api.extension.ExtensionContext context, CsvSource csvSource)
      Description copied from class: AnnotationBasedArgumentsProvider
      Provide a Stream of Arguments — based on metadata in the provided annotation — to be passed to a @ParameterizedTest method.
      Specified by:
      provideArguments in class AnnotationBasedArgumentsProvider<CsvSource>
      Parameters:
      context - the current extension context; never null
      csvSource - the annotation to process; never null
      Returns:
      a stream of arguments; never null
    • parseTextBlock

      private Stream<Arguments> parseTextBlock(CsvSource csvSource)
    • parseValueArray

      private Stream<Arguments> parseValueArray(CsvSource csvSource)
    • getHeaders

      static String[] getHeaders(com.univocity.parsers.csv.CsvParser csvParser)
    • processCsvRecord

      static Arguments processCsvRecord(Object[] csvRecord, Set<String> nullValues, boolean useHeadersInDisplayName, String[] headers)
      Processes custom null values, supports wrapping of column values in Named if necessary (for CSV header support), and returns the CSV record wrapped in an Arguments instance.
    • handleCsvException

      static RuntimeException handleCsvException(Throwable throwable, 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 throw statement