package com.ankurm.junitmigration; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvFileSource; import org.junit.jupiter.params.provider.CsvSource; /** * Not run by Surefire (the name does not end in Test). {@link BehaviourTest} launches it through the * JUnit Platform Launcher and records what each invocation was called and whether it passed, on whichever * JUnit version is on the class path. */ class CsvProbe { @ParameterizedTest @CsvSource({ "apple, 1", "'a,b', 2", " padded , 3", "'', 4", ", 5", "NIL, 6", "'it''s', 7", "\"dq\", 8" }) void basicRows(String name, int n) { } @ParameterizedTest @CsvSource(value = {"x;1", "y;2"}, delimiter = ';', useHeadersInDisplayName = false) void customDelimiter(String name, int n) { } @ParameterizedTest @CsvSource(textBlock = """ name, qty widget, 4 'multi word', 5 """, useHeadersInDisplayName = true) void textBlockWithHeader(String name, int qty) { } @ParameterizedTest @CsvSource(value = {"a,b,c"}) void tooManyColumnsForParameters(String first) { } @ParameterizedTest @CsvSource(value = {"1234567890,1"}, maxCharsPerColumn = 5) void columnLongerThanLimit(String value, int n) { } @ParameterizedTest @CsvFileSource(resources = "/probe.csv", numLinesToSkip = 1) void fileRows(String name, int n) { } }