package net.cvcg.ian.tictactoe;

import org.junit.Ignore;
import org.junit.Test;

import static org.junit.Assert.assertTrue;

public class TicTacToeBoardTest {

    @Test
    public void testMove() {
        TicTacToeBoard board = new TicTacToeBoard();
        board.move(Player.X, 0, 0);
        assertTrue(board.getBoard()[0][0] == Player.X);
    }

    @Ignore
    @Test(expected=IllegalArgumentException.class)
    public void testCannotMoveOverOtherPlayer() {
        TicTacToeBoard board = new TicTacToeBoard();
        board.move(Player.O, 0, 0);
        board.move(Player.X, 0, 0);
    }

    @Ignore
    @Test(expected=IllegalArgumentException.class)
    public void testOMovesCannotExceedXMoves() {
        TicTacToeBoard board = new TicTacToeBoard();
        board.move(Player.O, 0, 0);
    }

    @Test
    public void testGetWinnerInColumn() {
        TicTacToeBoard board = new TicTacToeBoard();
        board.move(Player.X, 0, 0);
        board.move(Player.O, 1, 0);
        board.move(Player.X, 0, 2);
        board.move(Player.O, 1, 1);
        board.move(Player.X, 2, 0);
        board.move(Player.O, 1, 2);
        assertTrue(board.getWinner() == Player.O);
    }

    @Test
    public void testGetWinnerInRow() {
        TicTacToeBoard board = new TicTacToeBoard();
        board.move(Player.X, 0, 2);
        board.move(Player.O, 0, 1);
        board.move(Player.X, 1, 2);
        board.move(Player.O, 0, 1);
        board.move(Player.X, 2, 2);
        assertTrue(board.getWinner() == Player.X);
    }

    @Test
    public void testGetWinnerInDiagonal() {
        TicTacToeBoard board = new TicTacToeBoard();
        board.move(Player.X, 0, 2);
        board.move(Player.O, 0, 0);
        board.move(Player.X, 1, 2);
        board.move(Player.O, 1, 1);
        board.move(Player.X, 2, 1);
        board.move(Player.O, 2, 2);
        assertTrue(board.getWinner() == Player.O);
    }


}

@@ -915,213 +915,575 @@
     
-board.move(Player.X, 0, 0);%0A        board.move(Player.O, 1, 0);%0A        board.move(Player.X, 0, 2);%0A        board.move(Player.O, 1, 1);%0A        board.move(Player.X, 2, 0);%0A        board.move(Player.O, 1, 2
+setupBoardForOColumnWin(board);%0A        board.move(Player.O, 1, 2);%0A        assertTrue(board.getWinner() == Player.O);%0A    %7D%0A%0A    private void setupBoardForOColumnWin(TicTacToeBoard board) %7B%0A        board.move(Player.X, 0, 0);%0A        board.move(Player.O, 1, 0);%0A        board.move(Player.X, 0, 2);%0A        board.move(Player.O, 1, 1);%0A        board.move(Player.X, 2, 0);%0A    %7D%0A%0A%0A    @Test%0A    public void testAIWinsWithNextColumnMoveIfAvailable() %7B%0A        TicTacToeBoard board = new TicTacToeBoard();%0A        setupBoardForOColumnWin(board);%0A        board.nextMoveAI(
 );%0A 

Add AI test for column win