Legger til test for at roboter som blir skubbet ut av brettet av transportbånd dør

Co-Authored-By: gabrielmagnus <gabrielmagnus@users.noreply.github.com>
This commit is contained in:
torlunjen 2020-04-21 16:08:15 +02:00
parent c969a3db04
commit 7bdf508c01

View File

@ -334,5 +334,21 @@ public class PhaseTest {
assertNull(board.getRobotOnPosition(new Position(7, 7)));
}
@Test
public void robotOnConveyorBeltFacingOutOfMapMovesAndDies() {
List<Robot> robots = new ArrayList<>();
List<Player> players = new ArrayList<>();
robots.add(new Robot(RobotID.ROBOT_1, new Position(7, 0)));
players.add(new Player(RobotID.ROBOT_1, "Player 1"));
try {
board = BoardLoaderUtil.loadBoard("boards/test_board.txt", robots);
Phase testPhase = new Phase(board, players, 0, null);
testPhase.moveAllConveyorBelts();
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
assertFalse(board.isRobotAlive(RobotID.ROBOT_1));
assertNull(board.getRobotOnPosition(new Position(7, 0)));
}
}