|
@ -36,6 +36,27 @@ class runGameTest { |
|
|
//assert |
|
|
//assert |
|
|
assertEquals(4, numLines); |
|
|
assertEquals(4, numLines); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
public void testReadFile(){ |
|
|
|
|
|
File file; |
|
|
|
|
|
try { |
|
|
|
|
|
file = File.createTempFile("temp", ".txt"); |
|
|
|
|
|
FileWriter writer = new FileWriter(file); |
|
|
|
|
|
writer.write("Zeile 1\n"); |
|
|
|
|
|
writer.write("Zeile 2\n"); |
|
|
|
|
|
writer.write("Zeile 3\n"); |
|
|
|
|
|
writer.close(); |
|
|
|
|
|
String[] lines = runGame.readFile(file.getAbsolutePath()); |
|
|
|
|
|
assertEquals("Zeile 1", lines[0]); |
|
|
|
|
|
assertEquals("Zeile 2", lines[1]); |
|
|
|
|
|
assertEquals("Zeile 3", lines[2]); |
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
|
// TODO Auto-generated catch block |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |