You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
buy-and-sell-n-times/src/test/java/SolutionTest.java

24 lines
869 B
Java

import com.github.stefanbirkner.systemlambda.SystemLambda;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.extension.ExtendWith;
5 years ago
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvFileSource;
import static org.junit.jupiter.api.Assertions.*;
@ExtendWith( BenchmarkExtension.class )
5 years ago
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() ));
}
5 years ago
}