@Test public void testCannotAttackEmptySquare() { Square currentSquare = new Square("a1"); Square emptySquare = new Square("c1"); board.placePiece(currentSquare, queen); assertFalse(queen.canAttack(board, currentSquare, emptySquare)); }
@Test public void testCannotAttackSameSquare() { Square currentSquare = new Square("a1"); Square occupiedSquare = new Square("a1"); board.placePiece(currentSquare, queen); assertFalse(queen.canAttack(board, currentSquare, occupiedSquare)); }
@Test public void testCanAttackStraightDown() { Square currentSquare = new Square("d5"); Square occupiedSquare = new Square("d1"); board.placePiece(currentSquare, queen); board.placePiece(occupiedSquare, new Queen(Color.BLACK)); assertTrue(queen.canAttack(board, currentSquare, occupiedSquare)); }
@Test public void testCanAttackDiagonallyDownAndRight() { Square currentSquare = new Square("d5"); Square occupiedSquare = new Square("f3"); board.placePiece(currentSquare, queen); board.placePiece(occupiedSquare, new Queen(Color.BLACK)); assertTrue(queen.canAttack(board, currentSquare, occupiedSquare)); }
@Test public void testCannotAttackWhenBlocked() { Square currentSquare = new Square("a1"); Square occupiedSquare = new Square("c1"); board.placePiece(currentSquare, queen); board.placePiece(new Square("b1"), new Queen(Color.WHITE)); board.placePiece(occupiedSquare, new Queen(Color.BLACK)); assertFalse(queen.canAttack(board, currentSquare, occupiedSquare)); }