mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Laget tester for for respawn metoden.
Tester at robot ikke kan spawne uten liv, og at de spawner på rett plass.
This commit is contained in:
parent
61c3a9ced6
commit
07b427be20
@ -129,4 +129,23 @@ public class BoardTest {
|
||||
board.moveRobot(robot.getRobotId(), Direction.NORTH);
|
||||
assertEquals(2, robot.getAmountOfLives());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void respawnRobotAtBackupPosition() {
|
||||
Robot robot = board.getAliveRobots().get(0);
|
||||
board.moveRobot(robot.getRobotId(), Direction.NORTH);
|
||||
board.removeDeadRobotFromBoard(robot);
|
||||
board.respawnRobots();
|
||||
assertEquals(robot.getBackupPosition(), someValidPosition1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void respawnRobotDoesNotRespawnARobotWithNoLives() {
|
||||
Robot robot = board.getAliveRobots().get(0);
|
||||
robot.setAmountOfLives(1);
|
||||
board.moveRobot(robot.getRobotId(), Direction.NORTH);
|
||||
board.removeDeadRobotFromBoard(robot);
|
||||
board.respawnRobots();
|
||||
assertFalse(board.isRobotAlive(robot.getRobotId()));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user