|
|
|
@ -1,8 +1,10 @@
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.AfterAll;
|
|
|
|
|
import org.junit.jupiter.api.BeforeAll;
|
|
|
|
|
import org.junit.jupiter.params.ParameterizedTest;
|
|
|
|
|
import org.junit.jupiter.params.converter.*;
|
|
|
|
|
import org.junit.jupiter.params.provider.CsvFileSource;
|
|
|
|
|
|
|
|
|
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
|
|
|
@ -10,6 +12,15 @@ import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
|
|
|
|
|
|
class SolutionTest {
|
|
|
|
|
|
|
|
|
|
static class SudokuConverter extends SimpleArgumentConverter {
|
|
|
|
|
@Override
|
|
|
|
|
protected Object convert( Object source, Class<?> targetType ) throws ArgumentConversionException {
|
|
|
|
|
assertEquals(String.class, targetType, "Can only convert to String");
|
|
|
|
|
BufferedReader in = new BufferedReader( new InputStreamReader( SolutionTest.class.getResourceAsStream( String.valueOf( source ))));
|
|
|
|
|
return in.lines().collect( Collectors.joining( System.lineSeparator() ));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static long totalDuration;
|
|
|
|
|
|
|
|
|
|
@BeforeAll
|
|
|
|
@ -24,7 +35,7 @@ class SolutionTest {
|
|
|
|
|
|
|
|
|
|
@ParameterizedTest
|
|
|
|
|
@CsvFileSource( resources = "testdata.csv" )
|
|
|
|
|
void main( final String input, final String expected ) throws IOException {
|
|
|
|
|
void main( @ConvertWith( SudokuConverter.class ) final String input, final String expected ) throws IOException {
|
|
|
|
|
// keep original streams
|
|
|
|
|
InputStream oldIn = System.in;
|
|
|
|
|
PrintStream oldOut = System.out;
|
|
|
|
|