quoridor/src/test/java/cz/xelfi/quoridor/BoardCase.java
changeset 237 38db4aae19d9
parent 219 d836818f5554
child 245 ba49bfb120f7
     1.1 --- a/quoridor/src/test/java/cz/xelfi/quoridor/BoardCase.java	Sun Jan 17 14:36:03 2010 +0100
     1.2 +++ b/quoridor/src/test/java/cz/xelfi/quoridor/BoardCase.java	Thu Apr 15 23:43:25 2010 +0200
     1.3 @@ -256,6 +256,33 @@
     1.4          b = move(b, 1, Player.Direction.SOUTH, Player.Direction.SOUTH);
     1.5      }
     1.6  
     1.7 +    public void testJumpBackForbidden() throws Exception {
     1.8 +        Board b = board;
     1.9 +
    1.10 +        for (int i = 0; i < 3; i++) {
    1.11 +            b = move(b, 0, Player.Direction.NORTH);
    1.12 +            b = move(b, 1, Player.Direction.SOUTH);
    1.13 +        }
    1.14 +
    1.15 +        b = move(b, 0, Player.Direction.NORTH);
    1.16 +
    1.17 +        b = fence(b, 1, 'D', 6, Orientation.HORIZONTAL);
    1.18 +
    1.19 +        try {
    1.20 +            b = move(b, 0, Player.Direction.NORTH, Player.Direction.NORTH);
    1.21 +            fail("Can't jump over a pawn when there is a fence");
    1.22 +        } catch (IllegalPositionException ex) {
    1.23 +            // OK
    1.24 +        }
    1.25 +
    1.26 +        try {
    1.27 +            b = move(b, 0, Player.Direction.NORTH, Player.Direction.SOUTH);
    1.28 +            fail("Can't bounce from the fence back neither");
    1.29 +        } catch (IllegalPositionException ex) {
    1.30 +            // OK
    1.31 +        }
    1.32 +    }
    1.33 +
    1.34      public void testCannotJumpOverFence () throws Exception {
    1.35          Board b = fence (board, 0, 'D', 8, Fence.Orientation.HORIZONTAL);
    1.36          assertEquals("One fence is present", 1, b.getFences().size());