|
@ -5,6 +5,7 @@ import org.junit.jupiter.api.BeforeEach; |
|
|
import org.junit.jupiter.api.Test; |
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
|
|
|
import static org.mockito.Mockito.mock; |
|
|
|
|
|
|
|
|
class ChessBoardTest { |
|
|
class ChessBoardTest { |
|
|
|
|
|
|
|
@ -77,4 +78,23 @@ class ChessBoardTest { |
|
|
assertFalse(chessBoard.isCellInBoard(4, 8)); |
|
|
assertFalse(chessBoard.isCellInBoard(4, 8)); |
|
|
assertFalse(chessBoard.isCellInBoard(10, 20)); |
|
|
assertFalse(chessBoard.isCellInBoard(10, 20)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void validateCleanPath() { |
|
|
|
|
|
ChessFigure[][] tempBoard = chessBoard.getBoard(); |
|
|
|
|
|
|
|
|
|
|
|
tempBoard[3][0] = mock(ChessFigure.class); |
|
|
|
|
|
tempBoard[3][5] = mock(ChessFigure.class); |
|
|
|
|
|
chessBoard.setChessBoard(tempBoard); |
|
|
|
|
|
|
|
|
|
|
|
assertFalse(chessBoard.validateCleanPath(-2, 0, 1, 4)); |
|
|
|
|
|
assertTrue(chessBoard.validateCleanPath(0, 3, 5, 3)); |
|
|
|
|
|
assertFalse(chessBoard.validateCleanPath(0, 3, 6, 3)); |
|
|
|
|
|
assertFalse(chessBoard.validateCleanPath(0, 3, 7, 3)); |
|
|
|
|
|
assertFalse(chessBoard.validateCleanPath(0, 3, 5, 5)); |
|
|
|
|
|
assertFalse(chessBoard.validateCleanPath(0, 3, 4, 7)); |
|
|
|
|
|
assertTrue(chessBoard.validateCleanPath(0, 3, 2, 5)); |
|
|
|
|
|
assertTrue(chessBoard.validateCleanPath(7, 3, 5, 5)); |
|
|
|
|
|
assertFalse(chessBoard.validateCleanPath(7, 3, 6, 6)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |