1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/quoridor/src/test/java/cz/xelfi/quoridor/BoardCase.java Sun May 10 22:42:27 2009 +0200
1.3 @@ -0,0 +1,253 @@
1.4 +package cz.xelfi.quoridor;
1.5 +
1.6 +import java.util.List;
1.7 +import junit.framework.TestCase;
1.8 +
1.9 +/**
1.10 + *
1.11 + * @author Jaroslav Tulach <jtulach@netbeans.org>
1.12 + */
1.13 +public abstract class BoardCase extends TestCase {
1.14 + protected Board board;
1.15 +
1.16 + protected BoardCase(String n) {
1.17 + super(n);
1.18 + board = Board.createEmptyBoard();
1.19 + }
1.20 +
1.21 + protected abstract Board move(Board b, int player, Board.Player.Direction... where)
1.22 + throws IllegalPositionException;
1.23 +
1.24 + protected abstract Board fence(Board b, int player, char x, int y, Board.Fence.Orientation orie)
1.25 + throws IllegalPositionException;
1.26 +
1.27 +
1.28 + public void testTwoPlayers () {
1.29 + List<Board.Player> list = board.getPlayers();
1.30 + assertEquals ("Two", 2, list.size ());
1.31 + assertFalse ("Both are non-null", list.contains (null));
1.32 + try {
1.33 + list.add (null);
1.34 + fail ("Modifications are not allowed");
1.35 + } catch (UnsupportedOperationException ex) {
1.36 + // ok
1.37 + }
1.38 + try {
1.39 + list.remove (0);
1.40 + fail ("Modifications are not allowed");
1.41 + } catch (UnsupportedOperationException ex) {
1.42 + // ok
1.43 + }
1.44 +
1.45 +
1.46 + assertEquals (8, list.get (0).getX());
1.47 + assertEquals (0, list.get (0).getY());
1.48 + assertEquals (10, list.get (0).getFences ());
1.49 + assertEquals (8, list.get (1).getX());
1.50 + assertEquals (16, list.get (1).getY());
1.51 + assertEquals (10, list.get (1).getFences ());
1.52 + }
1.53 +
1.54 + public void testFences () {
1.55 + assertEquals ("No on board", 0, board.getFences ().size ());
1.56 + try {
1.57 + board.getFences ().add (null);
1.58 + fail ("Should be unmodifiable");
1.59 + } catch (java.lang.UnsupportedOperationException ex) {
1.60 + // ok
1.61 + }
1.62 + }
1.63 +
1.64 + public void testFourTimesInAgainstEachOtherResultsInInvalidPosition () throws Exception {
1.65 + Board b = board;
1.66 +
1.67 + for (int i = 0; i < 3; i++) {
1.68 + b = move(b, 0, Board.Player.Direction.NORTH);
1.69 + b = move(b, 1, Board.Player.Direction.SOUTH);
1.70 + }
1.71 +
1.72 + b = move(b, 0, Board.Player.Direction.NORTH);
1.73 + try {
1.74 + b = move(b, 1, Board.Player.Direction.SOUTH);
1.75 + fail ("Now the positions of two players are supposed to be the same, this results in exception");
1.76 + } catch (IllegalPositionException ex) {
1.77 + // ok
1.78 + }
1.79 +
1.80 + }
1.81 +
1.82 + public void testCrossFences () throws Exception {
1.83 + Board b1 = board.fence (board.getPlayers ().get(0), 'A', 1, Board.Fence.Orientation.HORIZONTAL);
1.84 +
1.85 + try {
1.86 + b1.fence (b1.getPlayers ().get(1), 'A', 1, Board.Fence.Orientation.VERTICAL);
1.87 + fail ("This must fail, as the fences overlap");
1.88 + } catch (IllegalPositionException ex) {
1.89 + // ok
1.90 + }
1.91 + }
1.92 +
1.93 + public void testPawnsCanJumpOverEachOther () throws Exception {
1.94 + Board b = board;
1.95 +
1.96 + for (int i = 0; i < 3; i++) {
1.97 + b = move(b, 0, Board.Player.Direction.NORTH);
1.98 + b = move(b, 1, Board.Player.Direction.SOUTH);
1.99 + }
1.100 +
1.101 + b = move(b, 0, Board.Player.Direction.NORTH);
1.102 +
1.103 + // jump over
1.104 + b = move(b, 1, Board.Player.Direction.SOUTH, Board.Player.Direction.SOUTH);
1.105 + }
1.106 +
1.107 + public void testCannotJumpOverFence () throws Exception {
1.108 + Board b = board.fence (board.getPlayers ().get (0), 'D', 8, Board.Fence.Orientation.HORIZONTAL);
1.109 + try {
1.110 + move(b, 1, Board.Player.Direction.SOUTH);
1.111 + fail ("This shall not be allowed, as there is the fence");
1.112 + } catch (IllegalPositionException ex) {
1.113 + // ok
1.114 + }
1.115 + }
1.116 +
1.117 +
1.118 + public void testSideJumpsNotAllowedWhenThereIsNoFence () throws Exception {
1.119 + Board b = board;
1.120 +
1.121 + for (int i = 0; i < 3; i++) {
1.122 + b = move(b, 0, Board.Player.Direction.NORTH);
1.123 + b = move(b, 1, Board.Player.Direction.SOUTH);
1.124 + }
1.125 +
1.126 + b = move(b, 0, Board.Player.Direction.NORTH);
1.127 +
1.128 + try {
1.129 + b = move(b, 1, Board.Player.Direction.SOUTH, Board.Player.Direction.WEST);
1.130 + fail ("Cannot just jump aside");
1.131 + } catch (IllegalPositionException ex) {
1.132 + // ok
1.133 + }
1.134 + }
1.135 +
1.136 + public void testSideJumpsAllowedWhenThereAFence () throws Exception {
1.137 + Board b = board;
1.138 +
1.139 + for (int i = 0; i < 3; i++) {
1.140 + b = move(b, 0, Board.Player.Direction.NORTH);
1.141 + b = move(b, 1, Board.Player.Direction.SOUTH);
1.142 + }
1.143 +
1.144 + b = move(b, 0, Board.Player.Direction.NORTH);
1.145 +
1.146 + assertEquals (8, b.getPlayers ().get (0).getX ());
1.147 + assertEquals (8, b.getPlayers ().get (0).getY ());
1.148 +
1.149 + b = fence(b, 0, 'D', 4, Board.Fence.Orientation.HORIZONTAL);
1.150 +
1.151 + // we can over jump to west
1.152 + move(b, 1, Board.Player.Direction.SOUTH, Board.Player.Direction.WEST);
1.153 + // as well as east
1.154 + move(b, 1, Board.Player.Direction.SOUTH, Board.Player.Direction.EAST);
1.155 + }
1.156 +
1.157 + public void testAlwaysHasToHaveAccessToEndLine () throws Exception {
1.158 + Board b = board;
1.159 +
1.160 + b = b.fence (b.getPlayers ().get (0), 'E', 1, Board.Fence.Orientation.HORIZONTAL);
1.161 + b = b.fence (b.getPlayers ().get (0), 'F', 1, Board.Fence.Orientation.VERTICAL);
1.162 +
1.163 + try {
1.164 + b = b.fence (b.getPlayers ().get (0), 'D', 1, Board.Fence.Orientation.VERTICAL);
1.165 + fail ("This is not allowed as player 0 cannot now reach the final line");
1.166 + } catch (IllegalPositionException ex) {
1.167 + // ok
1.168 + }
1.169 +
1.170 + }
1.171 +
1.172 + public void testEqualsOfPlayers () throws Exception {
1.173 + Board.Player p1 = new Board.Player (1, 1, 10, Board.Player.Direction.EAST);
1.174 + Board.Player p2 = new Board.Player (1, 1, 10, Board.Player.Direction.EAST);
1.175 + Board.Player p3 = new Board.Player (2, 1, 10, Board.Player.Direction.EAST);
1.176 + Board.Player p4 = new Board.Player (1, 1, 10, Board.Player.Direction.WEST);
1.177 + Board.Player p5 = new Board.Player (1, 2, 10, Board.Player.Direction.EAST);
1.178 + Board.Player p6 = new Board.Player (1, 1, 5, Board.Player.Direction.EAST);
1.179 +
1.180 + assertEquals ("p1 == p2", p1, p2);
1.181 + if (p2.equals (p3)) fail ();
1.182 + if (p2.equals (p4)) fail ();
1.183 + if (p2.equals (p5)) fail ();
1.184 + if (p2.equals (p6)) fail ();
1.185 + if (p3.equals (p6)) fail ();
1.186 + if (p4.equals (p3)) fail ();
1.187 + if (p6.equals (p3)) fail ();
1.188 + if (p5.equals (p3)) fail ();
1.189 + if (p5.equals (p3)) fail ();
1.190 + if (p4.equals (p3)) fail ();
1.191 + if (p3.equals (p4)) fail ();
1.192 + if (p3.equals (p5)) fail ();
1.193 + if (p4.equals (p5)) fail ();
1.194 + if (p5.equals (p4)) fail ();
1.195 + if (p5.equals ("Ahoj")) fail ();
1.196 + }
1.197 +
1.198 + public void testEqualsOfFences () throws Exception {
1.199 + Board.Fence f1 = new Board.Fence (1, 1, Board.Fence.Orientation.HORIZONTAL);
1.200 + Board.Fence f2 = new Board.Fence (1, 1, Board.Fence.Orientation.HORIZONTAL);
1.201 + Board.Fence f3 = new Board.Fence (3, 1, Board.Fence.Orientation.HORIZONTAL);
1.202 + Board.Fence f4 = new Board.Fence (1, 3, Board.Fence.Orientation.HORIZONTAL);
1.203 + Board.Fence f5 = new Board.Fence (1, 1, Board.Fence.Orientation.VERTICAL);
1.204 +
1.205 + assertEquals ("f1 == f2", f1, f2);
1.206 + if (f1.equals (f3)) fail ();
1.207 + if (f3.equals (f1)) fail ();
1.208 + if (f5.equals (f1)) fail ();
1.209 + if (f1.equals (f5)) fail ();
1.210 + if (f4.equals (f1)) fail ();
1.211 + if (f1.equals (f4)) fail ();
1.212 + }
1.213 +
1.214 + public void testEqualsOfBoards1 () throws Exception {
1.215 + Board b1 = board.move (board.getPlayers ().get (0), Board.Player.Direction.NORTH);
1.216 + Board b2 = board.move (board.getPlayers ().get (0), Board.Player.Direction.NORTH);
1.217 + Board b3 = board.move (board.getPlayers ().get (0), Board.Player.Direction.EAST);
1.218 +
1.219 + if (b1.equals (b3)) fail ();
1.220 + if (b3.equals (b1)) fail ();
1.221 +
1.222 + assertEquals ("b1 == b2", b1, b2);
1.223 + }
1.224 + public void testEqualsOfBoards2 () throws Exception {
1.225 + Board b1 = board.fence (board.getPlayers ().get (0), 'E', 3, Board.Fence.Orientation.HORIZONTAL);
1.226 + Board b2 = board.fence (board.getPlayers ().get (0), 'E', 3, Board.Fence.Orientation.HORIZONTAL);
1.227 + Board b3 = board.fence (board.getPlayers ().get (0), 'D', 3, Board.Fence.Orientation.HORIZONTAL);
1.228 + Board b4 = board.fence (board.getPlayers ().get (0), 'E', 4, Board.Fence.Orientation.HORIZONTAL);
1.229 + Board b5 = board.fence (board.getPlayers ().get (0), 'E', 3, Board.Fence.Orientation.VERTICAL);
1.230 +
1.231 + if (b1.equals (b3)) fail ();
1.232 + if (b3.equals (b1)) fail ();
1.233 + if (b1.equals (b4)) fail ();
1.234 + if (b1.equals (b5)) fail ();
1.235 + if (b5.equals (b1)) fail ();
1.236 + if (b4.equals (b1)) fail ();
1.237 +
1.238 + assertEquals ("b1 == b2", b1, b2);
1.239 + }
1.240 + public void testEqualsOfBoardsWhenJumpOver () throws Exception {
1.241 + Board b = board;
1.242 +
1.243 + for (int i = 0; i < 3; i++) {
1.244 + b = move(b, 0, Board.Player.Direction.NORTH);
1.245 + b = move(b, 1, Board.Player.Direction.SOUTH);
1.246 + }
1.247 +
1.248 + Board b1 = move(b, 0, Board.Player.Direction.NORTH);
1.249 +
1.250 + Board b2 = move(b, 1, Board.Player.Direction.SOUTH);
1.251 + b2 = b2.move (b2.getPlayers ().get (0), Board.Player.Direction.NORTH, Board.Player.Direction.NORTH);
1.252 +
1.253 + if (b1.equals (b2)) fail ("Not the same, pawns are reverted");
1.254 + if (b2.equals (b1)) fail ("Not the same, pawns are reverted");
1.255 + }
1.256 +}
2.1 --- a/quoridor/src/test/java/cz/xelfi/quoridor/BoardTest.java Sun May 10 22:23:51 2009 +0200
2.2 +++ b/quoridor/src/test/java/cz/xelfi/quoridor/BoardTest.java Sun May 10 22:42:27 2009 +0200
2.3 @@ -7,252 +7,23 @@
2.4
2.5 package cz.xelfi.quoridor;
2.6
2.7 -import java.util.List;
2.8 -import junit.framework.*;
2.9 +import cz.xelfi.quoridor.Board.Player.Direction;
2.10
2.11 -/** Checks default setup of empty board.
2.12 +/** Basic tests in simple configuration.
2.13 *
2.14 * @author Jaroslav Tulach
2.15 */
2.16 -public class BoardTest extends TestCase {
2.17 -
2.18 - private Board board;
2.19 -
2.20 +public class BoardTest extends BoardCase {
2.21 public BoardTest (String testName) {
2.22 super (testName);
2.23 }
2.24
2.25 @Override
2.26 - protected void setUp () throws Exception {
2.27 - board = Board.createEmptyBoard ();
2.28 + protected Board move(Board b, int player, Direction... where) throws IllegalPositionException {
2.29 + return b.move(b.getPlayers().get(player), where);
2.30 }
2.31 -
2.32 - public void testTwoPlayers () {
2.33 - List<Board.Player> list = board.getPlayers();
2.34 - assertEquals ("Two", 2, list.size ());
2.35 - assertFalse ("Both are non-null", list.contains (null));
2.36 - try {
2.37 - list.add (null);
2.38 - fail ("Modifications are not allowed");
2.39 - } catch (UnsupportedOperationException ex) {
2.40 - // ok
2.41 - }
2.42 - try {
2.43 - list.remove (0);
2.44 - fail ("Modifications are not allowed");
2.45 - } catch (UnsupportedOperationException ex) {
2.46 - // ok
2.47 - }
2.48 -
2.49 -
2.50 - assertEquals (8, list.get (0).getX());
2.51 - assertEquals (0, list.get (0).getY());
2.52 - assertEquals (10, list.get (0).getFences ());
2.53 - assertEquals (8, list.get (1).getX());
2.54 - assertEquals (16, list.get (1).getY());
2.55 - assertEquals (10, list.get (1).getFences ());
2.56 - }
2.57 -
2.58 - public void testFences () {
2.59 - assertEquals ("No on board", 0, board.getFences ().size ());
2.60 - try {
2.61 - board.getFences ().add (null);
2.62 - fail ("Should be unmodifiable");
2.63 - } catch (java.lang.UnsupportedOperationException ex) {
2.64 - // ok
2.65 - }
2.66 - }
2.67 -
2.68 - public void testFourTimesInAgainstEachOtherResultsInInvalidPosition () throws Exception {
2.69 - Board b = board;
2.70 -
2.71 - for (int i = 0; i < 3; i++) {
2.72 - b = b.move (b.getPlayers ().get (0), Board.Player.Direction.NORTH);
2.73 - b = b.move (b.getPlayers ().get (1), Board.Player.Direction.SOUTH);
2.74 - }
2.75 -
2.76 - b = b.move (b.getPlayers ().get (0), Board.Player.Direction.NORTH);
2.77 - try {
2.78 - b = b.move (b.getPlayers ().get (1), Board.Player.Direction.SOUTH);
2.79 - fail ("Now the positions of two players are supposed to be the same, this results in exception");
2.80 - } catch (IllegalPositionException ex) {
2.81 - // ok
2.82 - }
2.83 -
2.84 - }
2.85 -
2.86 - public void testCrossFences () throws Exception {
2.87 - Board b1 = board.fence (board.getPlayers ().get(0), 'A', 1, Board.Fence.Orientation.HORIZONTAL);
2.88 -
2.89 - try {
2.90 - b1.fence (b1.getPlayers ().get(1), 'A', 1, Board.Fence.Orientation.VERTICAL);
2.91 - fail ("This must fail, as the fences overlap");
2.92 - } catch (IllegalPositionException ex) {
2.93 - // ok
2.94 - }
2.95 - }
2.96 -
2.97 - public void testPawnsCanJumpOverEachOther () throws Exception {
2.98 - Board b = board;
2.99 -
2.100 - for (int i = 0; i < 3; i++) {
2.101 - b = b.move (b.getPlayers ().get (0), Board.Player.Direction.NORTH);
2.102 - b = b.move (b.getPlayers ().get (1), Board.Player.Direction.SOUTH);
2.103 - }
2.104 -
2.105 - b = b.move (b.getPlayers ().get (0), Board.Player.Direction.NORTH);
2.106 -
2.107 - // jump over
2.108 - b = b.move (b.getPlayers ().get (1), Board.Player.Direction.SOUTH, Board.Player.Direction.SOUTH);
2.109 - }
2.110 -
2.111 - public void testCannotJumpOverFence () throws Exception {
2.112 - Board b = board.fence (board.getPlayers ().get (0), 'D', 8, Board.Fence.Orientation.HORIZONTAL);
2.113 - try {
2.114 - b.move (board.getPlayers ().get (1), Board.Player.Direction.SOUTH);
2.115 - fail ("This shall not be allowed, as there is the fence");
2.116 - } catch (IllegalPositionException ex) {
2.117 - // ok
2.118 - }
2.119 - }
2.120 -
2.121 -
2.122 - public void testSideJumpsNotAllowedWhenThereIsNoFence () throws Exception {
2.123 - Board b = board;
2.124 -
2.125 - for (int i = 0; i < 3; i++) {
2.126 - b = b.move (b.getPlayers ().get (0), Board.Player.Direction.NORTH);
2.127 - b = b.move (b.getPlayers ().get (1), Board.Player.Direction.SOUTH);
2.128 - }
2.129 -
2.130 - b = b.move (b.getPlayers ().get (0), Board.Player.Direction.NORTH);
2.131 -
2.132 - try {
2.133 - b = b.move (b.getPlayers ().get (1), Board.Player.Direction.SOUTH, Board.Player.Direction.WEST);
2.134 - fail ("Cannot just jump aside");
2.135 - } catch (IllegalPositionException ex) {
2.136 - // ok
2.137 - }
2.138 - }
2.139 -
2.140 - public void testSideJumpsAllowedWhenThereAFence () throws Exception {
2.141 - Board b = board;
2.142 -
2.143 - for (int i = 0; i < 3; i++) {
2.144 - b = b.move (b.getPlayers ().get (0), Board.Player.Direction.NORTH);
2.145 - b = b.move (b.getPlayers ().get (1), Board.Player.Direction.SOUTH);
2.146 - }
2.147 -
2.148 - b = b.move (b.getPlayers ().get (0), Board.Player.Direction.NORTH);
2.149 -
2.150 - assertEquals (8, b.getPlayers ().get (0).getX ());
2.151 - assertEquals (8, b.getPlayers ().get (0).getY ());
2.152 -
2.153 - b = b.fence(b.getPlayers ().get (0), 'D', 4, Board.Fence.Orientation.HORIZONTAL);
2.154 -
2.155 - // we can over jump to west
2.156 - b.move (b.getPlayers ().get (1), Board.Player.Direction.SOUTH, Board.Player.Direction.WEST);
2.157 - // as well as east
2.158 - b.move (b.getPlayers ().get (1), Board.Player.Direction.SOUTH, Board.Player.Direction.EAST);
2.159 - }
2.160 -
2.161 - public void testAlwaysHasToHaveAccessToEndLine () throws Exception {
2.162 - Board b = board;
2.163 -
2.164 - b = b.fence (b.getPlayers ().get (0), 'E', 1, Board.Fence.Orientation.HORIZONTAL);
2.165 - b = b.fence (b.getPlayers ().get (0), 'F', 1, Board.Fence.Orientation.VERTICAL);
2.166 -
2.167 - try {
2.168 - b = b.fence (b.getPlayers ().get (0), 'D', 1, Board.Fence.Orientation.VERTICAL);
2.169 - fail ("This is not allowed as player 0 cannot now reach the final line");
2.170 - } catch (IllegalPositionException ex) {
2.171 - // ok
2.172 - }
2.173 -
2.174 - }
2.175 -
2.176 - public void testEqualsOfPlayers () throws Exception {
2.177 - Board.Player p1 = new Board.Player (1, 1, 10, Board.Player.Direction.EAST);
2.178 - Board.Player p2 = new Board.Player (1, 1, 10, Board.Player.Direction.EAST);
2.179 - Board.Player p3 = new Board.Player (2, 1, 10, Board.Player.Direction.EAST);
2.180 - Board.Player p4 = new Board.Player (1, 1, 10, Board.Player.Direction.WEST);
2.181 - Board.Player p5 = new Board.Player (1, 2, 10, Board.Player.Direction.EAST);
2.182 - Board.Player p6 = new Board.Player (1, 1, 5, Board.Player.Direction.EAST);
2.183 -
2.184 - assertEquals ("p1 == p2", p1, p2);
2.185 - if (p2.equals (p3)) fail ();
2.186 - if (p2.equals (p4)) fail ();
2.187 - if (p2.equals (p5)) fail ();
2.188 - if (p2.equals (p6)) fail ();
2.189 - if (p3.equals (p6)) fail ();
2.190 - if (p4.equals (p3)) fail ();
2.191 - if (p6.equals (p3)) fail ();
2.192 - if (p5.equals (p3)) fail ();
2.193 - if (p5.equals (p3)) fail ();
2.194 - if (p4.equals (p3)) fail ();
2.195 - if (p3.equals (p4)) fail ();
2.196 - if (p3.equals (p5)) fail ();
2.197 - if (p4.equals (p5)) fail ();
2.198 - if (p5.equals (p4)) fail ();
2.199 - if (p5.equals ("Ahoj")) fail ();
2.200 - }
2.201 -
2.202 - public void testEqualsOfFences () throws Exception {
2.203 - Board.Fence f1 = new Board.Fence (1, 1, Board.Fence.Orientation.HORIZONTAL);
2.204 - Board.Fence f2 = new Board.Fence (1, 1, Board.Fence.Orientation.HORIZONTAL);
2.205 - Board.Fence f3 = new Board.Fence (3, 1, Board.Fence.Orientation.HORIZONTAL);
2.206 - Board.Fence f4 = new Board.Fence (1, 3, Board.Fence.Orientation.HORIZONTAL);
2.207 - Board.Fence f5 = new Board.Fence (1, 1, Board.Fence.Orientation.VERTICAL);
2.208 -
2.209 - assertEquals ("f1 == f2", f1, f2);
2.210 - if (f1.equals (f3)) fail ();
2.211 - if (f3.equals (f1)) fail ();
2.212 - if (f5.equals (f1)) fail ();
2.213 - if (f1.equals (f5)) fail ();
2.214 - if (f4.equals (f1)) fail ();
2.215 - if (f1.equals (f4)) fail ();
2.216 - }
2.217 -
2.218 - public void testEqualsOfBoards1 () throws Exception {
2.219 - Board b1 = board.move (board.getPlayers ().get (0), Board.Player.Direction.NORTH);
2.220 - Board b2 = board.move (board.getPlayers ().get (0), Board.Player.Direction.NORTH);
2.221 - Board b3 = board.move (board.getPlayers ().get (0), Board.Player.Direction.EAST);
2.222 -
2.223 - if (b1.equals (b3)) fail ();
2.224 - if (b3.equals (b1)) fail ();
2.225 -
2.226 - assertEquals ("b1 == b2", b1, b2);
2.227 - }
2.228 - public void testEqualsOfBoards2 () throws Exception {
2.229 - Board b1 = board.fence (board.getPlayers ().get (0), 'E', 3, Board.Fence.Orientation.HORIZONTAL);
2.230 - Board b2 = board.fence (board.getPlayers ().get (0), 'E', 3, Board.Fence.Orientation.HORIZONTAL);
2.231 - Board b3 = board.fence (board.getPlayers ().get (0), 'D', 3, Board.Fence.Orientation.HORIZONTAL);
2.232 - Board b4 = board.fence (board.getPlayers ().get (0), 'E', 4, Board.Fence.Orientation.HORIZONTAL);
2.233 - Board b5 = board.fence (board.getPlayers ().get (0), 'E', 3, Board.Fence.Orientation.VERTICAL);
2.234 -
2.235 - if (b1.equals (b3)) fail ();
2.236 - if (b3.equals (b1)) fail ();
2.237 - if (b1.equals (b4)) fail ();
2.238 - if (b1.equals (b5)) fail ();
2.239 - if (b5.equals (b1)) fail ();
2.240 - if (b4.equals (b1)) fail ();
2.241 -
2.242 - assertEquals ("b1 == b2", b1, b2);
2.243 - }
2.244 - public void testEqualsOfBoardsWhenJumpOver () throws Exception {
2.245 - Board b = board;
2.246 -
2.247 - for (int i = 0; i < 3; i++) {
2.248 - b = b.move (b.getPlayers ().get (0), Board.Player.Direction.NORTH);
2.249 - b = b.move (b.getPlayers ().get (1), Board.Player.Direction.SOUTH);
2.250 - }
2.251 -
2.252 - Board b1 = b.move (b.getPlayers ().get (0), Board.Player.Direction.NORTH);
2.253 -
2.254 - Board b2 = b.move (b.getPlayers ().get (1), Board.Player.Direction.SOUTH);
2.255 - b2 = b2.move (b2.getPlayers ().get (0), Board.Player.Direction.NORTH, Board.Player.Direction.NORTH);
2.256 -
2.257 - if (b1.equals (b2)) fail ("Not the same, pawns are reverted");
2.258 - if (b2.equals (b1)) fail ("Not the same, pawns are reverted");
2.259 + protected Board fence(Board b, int player, char x, int y, Board.Fence.Orientation orie)
2.260 + throws IllegalPositionException {
2.261 + return b.fence(b.getPlayers().get(player), x, y, orie);
2.262 }
2.263 }