From 0eac34a6c745d39fb2631a380f20d521df4918fe Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Thu, 12 Mar 2020 09:18:58 +0100 Subject: [PATCH] Do not test precise error message wording --- src/edu/kit/informatik/cardgame/MainTest.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/edu/kit/informatik/cardgame/MainTest.java b/src/edu/kit/informatik/cardgame/MainTest.java index d442e33..75a1957 100644 --- a/src/edu/kit/informatik/cardgame/MainTest.java +++ b/src/edu/kit/informatik/cardgame/MainTest.java @@ -60,8 +60,23 @@ class MainTest { System.setOut(new PrintStream(output)); Terminal.reload(); Main.main(null); + String outputStr = output.toString(); String expected = new String(readFile(out)); - assertEquals(expected, output.toString()); + String[] expectedLines = expected.split(System.lineSeparator()); + String[] actualLines = outputStr.split(System.lineSeparator()); + if (expectedLines.length != actualLines.length) { + assertEquals(expected, output.toString()); + } else { + for (int i = 0; i < actualLines.length; i++) { + if (expectedLines[i].startsWith("