webidor/src/test/java/cz/xelfi/quoridor/webidor/GamesTest.java
changeset 79 89bca098e14e
parent 52 45fb5f885591
child 82 9ac7acee7d9f
     1.1 --- a/webidor/src/test/java/cz/xelfi/quoridor/webidor/GamesTest.java	Sun Aug 30 16:04:27 2009 +0200
     1.2 +++ b/webidor/src/test/java/cz/xelfi/quoridor/webidor/GamesTest.java	Sat Sep 12 05:00:28 2009 +0200
     1.3 @@ -71,14 +71,22 @@
     1.4          File f = new File(dir, "x");
     1.5          f.getParentFile().mkdirs();
     1.6          FileOutputStream os = new FileOutputStream(f);
     1.7 -        os.write("# white: W\n# black: B\n# status: IN_PROGRESS\n\n\n".getBytes("UTF-8"));
     1.8 +        os.write("# white: W\n# black: B\n# status: IN_PROGRESS\nN S\n\n".getBytes("UTF-8"));
     1.9          os.close();
    1.10  
    1.11 +        Thread.sleep(1000);
    1.12 +        
    1.13 +        long middle = f.lastModified();
    1.14 +
    1.15 +        Thread.sleep(1000);
    1.16 +
    1.17          Games games = new Games(dir);
    1.18          Game g = games.getBoardInfo("x");
    1.19          assertNotNull("Game found", g);
    1.20          assertNotNull("Board found", g.getBoard());
    1.21 -        assertEquals("List of moves is empty", 0, g.getMoves().size());
    1.22 +        assertEquals("List of moves has two", 2, g.getMoves().size());
    1.23 +
    1.24 +        assertEquals("Last move is last touch of the file", middle, g.getId().getModified());
    1.25      }
    1.26  
    1.27  }