package nl.tudelft.jpacman.board;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;

import org.junit.Before;
import org.junit.Test;

/**
 * Test various aspects of board.
 * 
 * @author Jeroen Roosen 
 */
public class BoardTest {

	private Board board;
	
	private Square x0y0 = mock(Square.class);
	private Square x0y1 = mock(Square.class);
	private Square x0y2 = mock(Square.class);
	private Square x1y0 = mock(Square.class);
	private Square x1y1 = mock(Square.class);
	private Square x1y2 = mock(Square.class);
	
	private final int maxWidth = 2;
	private final int maxHeight = 3;
	
	/**
	 * Setup a board that can be used for testing.
	 */
	@Before
	public void setUp() {
		Square[][] grid = new Square[maxWidth][maxHeight];
		grid[0][0] = x0y0;
		grid[0][1] = x0y1;
		grid[0][2] = x0y2;
		grid[1][0] = x1y0;
		grid[1][1] = x1y1;
		grid[1][2] = x1y2;
		board = new Board(grid);
	}
	
	/**
	 * Verifies the board has the correct width.
	 */
	@Test
	public void verifyWidth() {
		assertEquals(maxWidth, board.getWidth());
	}
	
	/**
	 * Verifies the board has the correct height.
	 */
	@Test
	public void verifyHeight() {
		assertEquals(maxHeight, board.getHeight());
	}
	
	/**
	 * Verifies the square at x0y0 is indeed the right square.
	 */
	@Test
	public void verifyX0Y0() {
		assertEquals(x0y0, board.squareAt(0, 0));
	}
	
	/**
	 * Verifies the square at x1y2 is indeed the right square.
	 */
	@Test
	public void verifyX1Y2() {
		assertEquals(x1y2, board.squareAt(1, 2));
	}
	
	/**
	 * Verifies the square at x0y1 is indeed the right square.
	 */
	@Test
	public void verifyX0Y1() {
		assertEquals(x0y1, board.squareAt(0, 1));
	}
}

@@ -76,16 +76,105 @@
 quals;%0D%0A
+import static org.junit.Assert.assertFalse;%0D%0Aimport static org.junit.Assert.assertTrue;%0D%0A
 import s
@@ -1830,12 +1830,378 @@
 ));%0D%0A%09%7D%0D
+%0A%0D%0A%09@Test%0D%0A%09public void verifyBoardChange()%0D%0A%09%7B%0D%0A%09%09Square%5B%5D%5B%5D grid2 = new Square%5BmaxWidth%5D%5BmaxHeight%5D;%0D%0A%09%09grid2%5B0%5D%5B0%5D = x0y0;%0D%0A%09%09grid2%5B0%5D%5B1%5D = x0y1;%0D%0A%09%09grid2%5B0%5D%5B2%5D = x0y2;%0D%0A%09%09grid2%5B1%5D%5B0%5D = x1y0;%0D%0A%09%09grid2%5B1%5D%5B1%5D = x1y1;%0D%0A%09%09grid2%5B1%5D%5B2%5D = x1y2;%0D%0A%09%09assertFalse(grid2.equals(board.getBoard()));%0D%0A%09%09board.setBoard(grid2);%0D%0A%09%09assertTrue(grid2.equals(board.getBoard()));%0D%0A%09%7D%0D
 %0A%7D%0D%0A

Test unitaires suite