mirror of
https://gitlab.com/arnekeller/kit-programmieren-ws1920-final2.git
synced 2024-11-08 09:50:38 +00:00
Do not test precise error message wording
This commit is contained in:
parent
0b913bf943
commit
0eac34a6c7
@ -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("<e") || expectedLines[i].startsWith("Error, ")) {
|
||||
if (!actualLines[i].startsWith("Error, ")) {
|
||||
assertEquals(expected, output.toString());
|
||||
}
|
||||
} else if (!expectedLines[i].equals(actualLines[i])) {
|
||||
assertEquals(expected, output.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] readFile(String name) throws IOException {
|
||||
|
Loading…
Reference in New Issue
Block a user