@Test(expected = IllegalArgumentException.class) public void putACellInStateOnIncorrectRow_shouldThrowIllegalArgumentException() { Board board = new Board(4, 8); board.setCellState(-1, 0, CellState.ALIVE); }
public void setCellState(int row, int col, int state) { if (!areValidCoordinates(row, col)) { throw new IllegalArgumentException(row + ", " + col + " are not valid coordinates"); } board[row][col] = state; }
Board implements Cloneable { public void setCellState(int row, int col, int state) { if (!areValidCoordinates(row, col)) { throw new IllegalArgumentException(row + ", " + col + " are not valid coordinates"); } board[row][col] = state; } }
Board implements Cloneable { public void setCellState(int row, int col, int state) { if (!areValidCoordinates(row, col)) { throw new IllegalArgumentException(row + ", " + col + " are not valid coordinates"); } board[row][col] = state; } Board(int rows, int cols);  Board(int[][] board); }
Board implements Cloneable { public void setCellState(int row, int col, int state) { if (!areValidCoordinates(row, col)) { throw new IllegalArgumentException(row + ", " + col + " are not valid coordinates"); } board[row][col] = state; } Board(int rows, int cols);  Board(int[][] board); void setCellState(int row, int col, int state); int getCellSate(int row, int col); boolean areValidCoordinates(int row, int col); int getTotalSize(); int getRows(); int getCols(); boolean isBottomRightAlive(int row, int col); boolean isBottomAlive(int row, int col); boolean isBottomLeftAlive(int row, int col); boolean isRightAlive(int row, int col); boolean isLeftAlive(int row, int col); boolean isTopRightAlive(int row, int col); boolean isTopAlive(int row, int col); boolean isTopLeftAlive(int row, int col); int getAliveNeighbours(int row, int col); @Override Board clone(); @Override String toString(); }
Board implements Cloneable { public void setCellState(int row, int col, int state) { if (!areValidCoordinates(row, col)) { throw new IllegalArgumentException(row + ", " + col + " are not valid coordinates"); } board[row][col] = state; } Board(int rows, int cols);  Board(int[][] board); void setCellState(int row, int col, int state); int getCellSate(int row, int col); boolean areValidCoordinates(int row, int col); int getTotalSize(); int getRows(); int getCols(); boolean isBottomRightAlive(int row, int col); boolean isBottomAlive(int row, int col); boolean isBottomLeftAlive(int row, int col); boolean isRightAlive(int row, int col); boolean isLeftAlive(int row, int col); boolean isTopRightAlive(int row, int col); boolean isTopAlive(int row, int col); boolean isTopLeftAlive(int row, int col); int getAliveNeighbours(int row, int col); @Override Board clone(); @Override String toString();  }