1.1 --- a/webidor/src/test/java/cz/xelfi/quoridor/webidor/GamesTest.java Sat Sep 19 14:38:29 2009 +0200
1.2 +++ b/webidor/src/test/java/cz/xelfi/quoridor/webidor/GamesTest.java Sat Sep 26 21:47:02 2009 +0200
1.3 @@ -90,4 +90,26 @@
1.4 assertEquals("Last move is last touch of the file", middle, g.getId().getModified());
1.5 }
1.6
1.7 + @Test public void testLoadGameWithComments() throws Exception {
1.8 + File f = new File(dir, "x");
1.9 + f.getParentFile().mkdirs();
1.10 + FileOutputStream os = new FileOutputStream(f);
1.11 + os.write("# white: W\n# black: B\n# status: IN_PROGRESS\nN #good move\n... S # ok move\n\n".getBytes("UTF-8"));
1.12 + os.close();
1.13 +
1.14 + Thread.sleep(1000);
1.15 +
1.16 + long middle = f.lastModified();
1.17 +
1.18 + Thread.sleep(1000);
1.19 +
1.20 + Games games = new Games(dir, new Quoridor());
1.21 + Game g = games.getBoardInfo("x", -1);
1.22 + assertNotNull("Game found", g);
1.23 + assertNotNull("Board found", g.getBoard());
1.24 + assertEquals("List of moves has two", 2, g.getMoves().size());
1.25 +
1.26 + assertEquals("Last move is last touch of the file", middle, g.getId().getModified());
1.27 + }
1.28 +
1.29 }