package ru.pravvich.figures;

import org.junit.Test;
import ru.pravvich.Cell;
import ru.pravvich.ImposableMoveException;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

public class OfficerTest {

    @Test
    public void whenThenReturnArrayCellRoadWithoutFinishCell() throws ImposableMoveException {
        Figure[][] desc = new Figure[8][8];
        for (int i = 0; i != 8; i++) {
            desc[i][i] = new Place(new Cell(i, i), "");
        }
        desc[4][4] = new Officer(new Cell(4, 4), "white");
        Cell[] result = desc[4][4].move(new Cell(7, 7));
        assertThat(result.length, is(2));
    }

    @Test
    public void whenRoadNotImposableForOfficerThenThrowImposableMoveException() throws ImposableMoveException {
        Figure[][] desc = new Figure[8][8];
        for (int i = 0; i != 8; i++) {
            desc[i][i] = new Place(new Cell(i, i), "");
        }
        desc[4][4] = new Officer(new Cell(4, 4), "white");
        Cell[] result = desc[4][4].move(new Cell(6, 7));
        assertThat(result.length, is(0));
    }
}
@@ -115,16 +115,64 @@
 ption;%0A%0A
+import static org.hamcrest.Matchers.instanceOf;%0A
 import s
@@ -272,16 +272,558 @@
 erTest %7B
+%0A    @Test%0A    public void whenFigureMoveNotDiagonalThenNothingOccurs() throws ImposableMoveException %7B%0A        Figure%5B%5D%5B%5D desc = new Figure%5B8%5D%5B8%5D;%0A        for (int i = 0; i != 8; i++) %7B%0A            for (int j = 0; j != desc.length; j++) %7B%0A                desc%5Bi%5D%5Bj%5D = new Place(new Cell(i, i), %22%22);%0A            %7D%0A        %7D%0A        desc%5B4%5D%5B4%5D = new Officer(new Cell(4, 4), %22white%22);%0A        desc%5B4%5D%5B4%5D.move(new Cell(5, 7));%0A        assertThat(desc%5B4%5D%5B4%5D.getColor(), is(%22white%22));%0A        assertThat(desc%5B4%5D%5B7%5D, instanceOf(Place.class));%0A    %7D
 %0A%0A    @T

add BoardTests