support multiple output lines in test

This commit is contained in:
Lothar Buchholz 2020-02-22 23:48:38 +01:00
parent 6b5cb71874
commit bd5d3fab64

View File

@ -53,7 +53,14 @@ class SolutionTest {
System.out.println( String.format( "Solution took %01d.%03d secs", duration / 1000, duration % 1000 ));
try (BufferedReader chk = new BufferedReader( new InputStreamReader( new ByteArrayInputStream( bos.toByteArray() )))) {
assertEquals( expected, chk.readLine() );
String[] expectedLines = expected.split( "\\s*[|]\\s*" );
int lineCount = 0;
String line;
for ( ; (line = chk.readLine()) != null; lineCount++ ) {
assertEquals( expectedLines[ lineCount ], line );
}
assertEquals( expectedLines.length, lineCount );
}
}
finally {