mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Legger til en test for faser
This commit is contained in:
parent
c13bd0c838
commit
db5b4c503a
42
src/test/java/inf112/fiasko/roborally/objects/PhaseTest.java
Normal file
42
src/test/java/inf112/fiasko/roborally/objects/PhaseTest.java
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
package inf112.fiasko.roborally.objects;
|
||||||
|
|
||||||
|
import inf112.fiasko.roborally.elementproperties.Position;
|
||||||
|
import inf112.fiasko.roborally.elementproperties.RobotID;
|
||||||
|
import inf112.fiasko.roborally.utility.BoardLoaderUtil;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static junit.framework.TestCase.assertEquals;
|
||||||
|
|
||||||
|
public class PhaseTest {
|
||||||
|
private Phase phase;
|
||||||
|
private Board board;
|
||||||
|
private Position robot1Position;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
List<Robot> robots = new ArrayList<>();
|
||||||
|
robot1Position = new Position(2, 2);
|
||||||
|
robots.add(new Robot(RobotID.ROBOT_1, robot1Position));
|
||||||
|
robots.add(new Robot(RobotID.ROBOT_2, new Position(3, 2)));
|
||||||
|
List<Player> playerList = new ArrayList<>();
|
||||||
|
playerList.add(new Player(RobotID.ROBOT_1, "Player 1"));
|
||||||
|
playerList.add(new Player(RobotID.ROBOT_2, "Player 2"));
|
||||||
|
try {
|
||||||
|
board = BoardLoaderUtil.loadBoard("boards/Checkmate.txt", robots);
|
||||||
|
this.phase = new Phase(board, playerList, 0, null);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void robotCannotLeaveConveyorBeltIfBlockedByRobot() throws InterruptedException {
|
||||||
|
phase.moveAllConveyorBelts();
|
||||||
|
assertEquals(RobotID.ROBOT_1, board.getRobotOnPosition(robot1Position));
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user