import com.github.stefanbirkner.systemlambda.SystemLambda; import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvFileSource; import static org.junit.jupiter.api.Assertions.*; @ExtendWith( BenchmarkExtension.class ) class SolutionTest { @ParameterizedTest @CsvFileSource( resources = "testdata.csv" ) void main( final String sellCount, final String input, final String expected ) throws Exception { String output = SystemLambda.tapSystemOutNormalized( () -> SystemLambda.withTextFromSystemIn( sellCount + " " + input ) .execute( () -> Solution.main( new String[0] )) ); assertEquals( expected, StringUtils.chomp( output.trim() )); } }