Fikset Bug ved Test av respawn

This commit is contained in:
Steinar Aalstad Lillesund 2020-02-26 20:52:55 +01:00
parent 943886152e
commit 5d3bbb1a66
2 changed files with 4 additions and 4 deletions

View File

@ -304,10 +304,9 @@ public class Board {
robot.setFacingDirection(Direction.NORTH); robot.setFacingDirection(Direction.NORTH);
robots.put(robot.getRobotId(), robot); robots.put(robot.getRobotId(), robot);
} }
else { else {deadRobots.remove(robot); }
deadRobots.remove(robot);
}
} }
deadRobots = new ArrayList<>();
} }
/** /**

View File

@ -132,7 +132,8 @@ public class BoardTest {
@Test @Test
public void respawnRobotAtBackupPosition() { public void respawnRobotAtBackupPosition() {
Robot robot = board.getAliveRobots().get(0); Robot robot = robotList.get(0);
robot.setPosition(new Position(0, 0));
board.moveRobot(robot.getRobotId(), Direction.NORTH); board.moveRobot(robot.getRobotId(), Direction.NORTH);
board.removeDeadRobotFromBoard(robot); board.removeDeadRobotFromBoard(robot);
board.respawnRobots(); board.respawnRobots();