webidor/src/test/java/cz/xelfi/quoridor/webidor/QuoridorTest.java
changeset 39 6b889f2717e9
parent 37 782d925cb5a1
child 41 c94f68ddef59
     1.1 --- a/webidor/src/test/java/cz/xelfi/quoridor/webidor/QuoridorTest.java	Wed Jul 29 08:19:35 2009 +0200
     1.2 +++ b/webidor/src/test/java/cz/xelfi/quoridor/webidor/QuoridorTest.java	Wed Jul 29 18:48:04 2009 +0200
     1.3 @@ -30,10 +30,13 @@
     1.4  import com.sun.jersey.api.client.UniformInterfaceException;
     1.5  import com.sun.jersey.core.header.MediaTypes;
     1.6  import com.sun.jersey.test.framework.JerseyTest;
     1.7 +import cz.xelfi.quoridor.Board;
     1.8 +import cz.xelfi.quoridor.Move;
     1.9 +import cz.xelfi.quoridor.webidor.resources.Games;
    1.10 +import cz.xelfi.quoridor.webidor.resources.Quoridor;
    1.11  import java.io.File;
    1.12  import java.io.FileReader;
    1.13  import java.io.IOException;
    1.14 -import java.util.Arrays;
    1.15  import java.util.List;
    1.16  import org.junit.Test;
    1.17  import static org.junit.Assert.*;
    1.18 @@ -133,6 +136,15 @@
    1.19          if (!content.contains("N S")) {
    1.20              fail(content);
    1.21          }
    1.22 +
    1.23 +        Games read = new Games(new File(dir, "games"));
    1.24 +        List<Game> readGames = read.getGames();
    1.25 +        assertEquals("One game read", 1, readGames.size());
    1.26 +        Board board = read.getGames().get(0).getBoard();
    1.27 +        assertEquals(1, board.getPlayers().get(0).getRow());
    1.28 +        assertEquals(7, board.getPlayers().get(1).getRow());
    1.29 +        assertEquals(Move.NORTH, read.getGames().get(0).getMoves().get(0));
    1.30 +        assertEquals(Move.SOUTH, read.getGames().get(0).getMoves().get(1));
    1.31      }
    1.32  
    1.33  }