Legger til test for at en robot ikke blir flyttet av et transportbånd når den har en robot forran seg som ikke kan bevege seg

Co-Authored-By: gabrielmagnus <gabrielmagnus@users.noreply.github.com>
This commit is contained in:
torlunjen 2020-04-21 15:03:34 +02:00
parent 9eeb4b4c0d
commit 7644b68a47

View File

@ -214,5 +214,23 @@ public class PhaseTest {
assertEquals(RobotID.ROBOT_1, board.getRobotOnPosition(new Position(1, 1)));
}
@Test
public void robotBehindAnotherRobotOnConveyorBeltsFacingWallDoesNotMove() {
List<Robot> robots = new ArrayList<>();
List<Player> players = new ArrayList<>();
robots.add(new Robot(RobotID.ROBOT_1, new Position(1, 1)));
robots.add(new Robot(RobotID.ROBOT_2, new Position(1, 2)));
players.add(new Player(RobotID.ROBOT_1, "Player 1"));
players.add(new Player(RobotID.ROBOT_2, "Player 2"));
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();
}
assertEquals(RobotID.ROBOT_1, board.getRobotOnPosition(new Position(1, 1)));
assertEquals(RobotID.ROBOT_2, board.getRobotOnPosition(new Position(1, 2)));
}
}