import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
 * Created by Stephen West on 29/11/2018.
 */
class TestBoard {

    private SnakeGame sg;

    private final int[] SIZE_5x5 = {5,5};
    private final int[] SIZE_3x5 = {3,5};
    private final int[] SIZE_4x4 = {4,4};


    @BeforeEach
    void setUp(){
        sg = new SnakeGame(SIZE_5x5);
    }



    @Test
    void testEmptyBoardOFSize5x5isCreatedCorrectly(){
        sg = new SnakeGame(SIZE_5x5);
        String expBoardString = TestUtils.getTestCase("data01.txt","e5x5");

        assertEquals(expBoardString,sg.getBoardString());


    }

    @Test
    void testEmptyBoardOFSize3x5isCreatedCorrectly(){
        sg = new SnakeGame(SIZE_3x5);
        assertEquals(TestUtils.getTestCase("data01.txt","e3x5"), sg.getBoardString());


    }

    @Test
    void testEmptyBoardOFSize4x4isCreatedCorrectly(){
        sg = new SnakeGame(SIZE_4x4);
        assertEquals(TestUtils.getTestCase("data01.txt","e4x4"), sg.getBoardString());
    }

    @Test
    void testThatAllGetPosDetailIsEmptyOnAnEmptyBoard(){
        for (int row = 0;row <SIZE_5x5[0] ;row++){
            for (int col = 0; col <SIZE_5x5[1];col++){
                assertEquals(BLOCK.IS_EMPTY,sg.at(new int[]{row,col}));
            }
        }
    }

    @Test
    void thatSnakePlaceAtGivenPosReturnsIS_SNAKE(){
        sg.startSnakeAt(new int[] {0,0});
        assertEquals(BLOCK.IS_SNAKE,sg.at(new int[]{0,0}));
    }

    @Test
    void thatSnakeCanMoveInEachDirections(){

        sg.startSnakeAt(new int[] {2,2});
        sg.moveSnake(MOVE.UP);
        assertEquals(BLOCK.IS_SNAKE,sg.at(new int[]{1,2}));
        sg.moveSnake(MOVE.DOWN);
        assertEquals(BLOCK.IS_SNAKE,sg.at(new int[]{2,2}));
        sg.moveSnake(MOVE.LEFT);
        assertEquals(BLOCK.IS_SNAKE,sg.at(new int[]{2,1}));
        sg.moveSnake(MOVE.RIGHT);
        assertEquals(BLOCK.IS_SNAKE,sg.at(new int[]{2,2}));


    }
}

@@ -1561,20 +1561,18 @@
 anMoveIn
-Each
+UP
 Directio
@@ -1707,107 +1707,318 @@
 t%5B%5D%7B
-1
+3
 ,2%7D));%0A
-        sg.moveSnake(MOVE.DOWN);%0A        assertEquals(BLOCK.IS_SNAKE,sg.at(new int%5B%5D
+%0A    %7D%0A    @Test%0A    void thatSnakeCanMoveInDOWNDirections()%7B%0A%0A        sg.startSnakeAt(new int%5B%5D %7B2,2%7D);%0A        sg.moveSnake(MOVE.DOWN);%0A        assertEquals(BLOCK.IS_SNAKE,sg.at(new int%5B%5D%7B1,2%7D));%0A%0A    %7D%0A    @Test%0A    void thatSnakeCanMoveInRIGHTDirections()%7B%0A%0A        sg.startSnakeAt(new int%5B%5D 
 %7B2,2%7D)
-)
 ;%0A  
@@ -2045,11 +2045,12 @@
 OVE.
-LEF
+RIGH
 T);%0A
@@ -2107,13 +2107,118 @@
 %5D%7B2,
-1
+3
 %7D));
+%0A%0A    %7D%0A    @Test%0A    void thatSnakeCanMoveInLEFTDirections()%7B%0A%0A        sg.startSnakeAt(new int%5B%5D %7B2,2%7D);
 %0A   
@@ -2232,36 +2232,35 @@
 .moveSnake(MOVE.
-RIGH
+LEF
 T);%0A        asse
@@ -2305,16 +2305,15 @@
 %5D%7B2,
-2
+1
 %7D));%0A%0A
-%0A
     

complete simple move snake test