mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Fikser litt på testene til Robot
This commit is contained in:
parent
eb3199b5fd
commit
fe42257cb4
@ -10,61 +10,69 @@ import org.junit.Test;
|
||||
public class RobotTest {
|
||||
private Position robotPosition;
|
||||
private Robot testRobot;
|
||||
private int nextFlag = 1;
|
||||
|
||||
@Before
|
||||
public void setUp(){
|
||||
public void setUp() {
|
||||
robotPosition = new Position(3,6);
|
||||
testRobot = new Robot(RobotID.ROBOT_6, robotPosition);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRobotGetDamageOnInitializedRobot(){
|
||||
assertEquals(0, testRobot.getDamage());
|
||||
assertEquals(0, testRobot.getDamageTaken());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRobotGetPlayerId(){
|
||||
assertEquals(RobotID.ROBOT_6, testRobot.getRobotId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRobotGetBackupOnInitializedRobot(){
|
||||
assertEquals(robotPosition, testRobot.getBackupPosition());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRobotSetDamage(){
|
||||
testRobot.setDamage(2);
|
||||
assertEquals(2, testRobot.getDamage());
|
||||
public void testRobotSetDamage() {
|
||||
testRobot.setDamageTaken(2);
|
||||
assertEquals(2, testRobot.getDamageTaken());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRobotGetPositionOnInitializedRobot(){
|
||||
assertEquals(robotPosition, testRobot.getPosition());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRobotGetPositionOnRobotWithNewPosition(){
|
||||
public void testRobotGetPositionOnRobotWithNewPosition() {
|
||||
Position newRobotPosition = new Position(8,12);
|
||||
testRobot.setPosition(newRobotPosition);
|
||||
assertEquals(newRobotPosition, testRobot.getPosition());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRobotIsInPowerDownOnInitializedRobot(){
|
||||
assertEquals(false, testRobot.isInPowerDown());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRobotSetPowerDown(){
|
||||
public void testRobotSetPowerDown() {
|
||||
testRobot.setPowerDown(true);
|
||||
assertEquals(true, testRobot.isInPowerDown());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRobotGetNewFlag(){
|
||||
int nextFlag = 2;
|
||||
Position nextFlagPosition = new Position(3,4);
|
||||
testRobot.setLastFlagVisitedAndBackupPosition(nextFlag,nextFlagPosition);
|
||||
assertEquals(2, testRobot.getLastFlagVisited());
|
||||
public void testRobotGetNewFlag() {
|
||||
testRobot.setLastFlagVisitedAndUpdateBackupPosition(nextFlag);
|
||||
assertEquals(1, testRobot.getLastFlagVisited());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRobotGetNewBackup(){
|
||||
int nextFlag = 2;
|
||||
public void testRobotGetNewBackup() {
|
||||
Position nextFlagPosition = new Position(3,4);
|
||||
testRobot.setLastFlagVisitedAndBackupPosition(nextFlag,nextFlagPosition);
|
||||
testRobot.setPosition(nextFlagPosition);
|
||||
testRobot.setLastFlagVisitedAndUpdateBackupPosition(nextFlag);
|
||||
assertEquals(nextFlagPosition, testRobot.getBackupPosition());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user