1.1 --- a/webidor/src/test/java/cz/xelfi/quoridor/webidor/GamesTest.java Tue Sep 14 08:56:13 2010 +0200
1.2 +++ b/webidor/src/test/java/cz/xelfi/quoridor/webidor/GamesTest.java Sat Nov 27 09:10:22 2010 +0100
1.3 @@ -42,7 +42,8 @@
1.4 @Before
1.5 public void setUp() throws Exception {
1.6 dir = File.createTempFile("quoridor", ".dir");
1.7 - dir.delete();
1.8 + deleteRec(dir);
1.9 + dir.mkdirs();
1.10 System.setProperty("quoridor.dir", dir.getPath());
1.11 }
1.12
1.13 @@ -65,7 +66,7 @@
1.14 }
1.15
1.16 @Test public void testCreateAGame() throws Exception {
1.17 - File f = new File(dir, "x");
1.18 + File f = new File(new File(dir, "games"), "x");
1.19 f.getParentFile().mkdirs();
1.20 FileOutputStream os = new FileOutputStream(f);
1.21 os.write("# white: W\n# black: B\n# status: IN_PROGRESS\nN S\n\n".getBytes("UTF-8"));
1.22 @@ -77,7 +78,7 @@
1.23
1.24 Thread.sleep(1000);
1.25
1.26 - Games games = new Games(dir, new Quoridor());
1.27 + Games games = new Games(f.getParentFile(), new Quoridor());
1.28 Game g = games.getBoardInfo("", "x", -1);
1.29 assertNotNull("Game found", g);
1.30 assertNotNull("Board found", g.getBoard());
1.31 @@ -87,7 +88,7 @@
1.32 }
1.33
1.34 @Test public void testLoadGameWithComments() throws Exception {
1.35 - File f = new File(dir, "x");
1.36 + File f = new File(new File(dir, "games"), "x");
1.37 f.getParentFile().mkdirs();
1.38 FileOutputStream os = new FileOutputStream(f);
1.39 os.write("# white: W\n# black: B\n# status: IN_PROGRESS\nN #good move\n... S # ok move\n\n".getBytes("UTF-8"));
1.40 @@ -99,7 +100,7 @@
1.41
1.42 Thread.sleep(1000);
1.43
1.44 - Games games = new Games(dir, new Quoridor());
1.45 + Games games = new Games(f.getParentFile(), new Quoridor());
1.46 Game g = games.getBoardInfo("", "x", -1);
1.47 assertNotNull("Game found", g);
1.48 assertNotNull("Board found", g.getBoard());
1.49 @@ -109,7 +110,7 @@
1.50 }
1.51
1.52 @Test public void testLoadGameWithInternationalComments() throws Exception {
1.53 - File f = new File(dir, "x");
1.54 + File f = new File(new File(dir, "games"), "x");
1.55 f.getParentFile().mkdirs();
1.56 FileOutputStream os = new FileOutputStream(f);
1.57 ResourceBundle b = ResourceBundle.getBundle("cz/xelfi/quoridor/webidor/TestBundle");
1.58 @@ -124,7 +125,7 @@
1.59
1.60 Thread.sleep(1000);
1.61
1.62 - Games games = new Games(dir, new Quoridor());
1.63 + Games games = new Games(f.getParentFile(), new Quoridor());
1.64 Game g = games.getBoardInfo("", "x", -1);
1.65 assertNotNull("Game found", g);
1.66 assertNotNull("Board found", g.getBoard());