package cz.moneta.test.sandbox.dsl;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.annotations.ParameterizedTestCase;
import cz.moneta.test.harness.annotations.TestScenario;
import org.junit.jupiter.params.provider.CsvFileSource;

import java.util.stream.Collectors;
import java.util.stream.Stream;

@TestScenario(name = "Example of ParameterizedTestCase from CSV")
public class CsvParametrizedTestExample {

    /**
     * https://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests-argument-aggregation-custom
     */
    @ParameterizedTestCase(name = "Example of ParameterizedTestCase from CSV")
    @CsvFileSource(resources = "/sandbox/csv_file_source_example.csv", delimiter = ';', numLinesToSkip = 1)
    public void allBridgeLoanPurposes(String column1, String column2, String column3, Harness harness) {
        harness.log("This test is running with parameters: " + Stream.of(column1, column2, column3).collect(Collectors.joining(", ")));
    }

}