From bd5d3fab64188e633388bda1962b5c375d24598e Mon Sep 17 00:00:00 2001 From: Lothar Buchholz Date: Sat, 22 Feb 2020 23:48:38 +0100 Subject: [PATCH] support multiple output lines in test --- src/test/java/SolutionTest.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/test/java/SolutionTest.java b/src/test/java/SolutionTest.java index aee63e4..3afa238 100644 --- a/src/test/java/SolutionTest.java +++ b/src/test/java/SolutionTest.java @@ -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 {