dev MoveListStrategy and test
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package ch.zhaw.pm2.racetrack;
|
||||
|
||||
import ch.zhaw.pm2.racetrack.strategy.MoveListStrategy;
|
||||
import ch.zhaw.pm2.racetrack.strategy.MoveStrategy;
|
||||
import org.junit.jupiter.api.*;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
public class MoveStrategyTest {
|
||||
|
||||
private MoveStrategy moveList;
|
||||
|
||||
@Nested
|
||||
@DisplayName("MoveListStrategy")
|
||||
class MoveList {
|
||||
|
||||
|
||||
@BeforeEach
|
||||
void setup() {
|
||||
try {
|
||||
moveList = new MoveListStrategy(".\\moves\\challenge-car-a.txt");
|
||||
}catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void checkMove() {
|
||||
Assertions.assertEquals(PositionVector.Direction.RIGHT,moveList.nextMove());
|
||||
for (int i = 0; i < 3; i++) {
|
||||
moveList.nextMove();
|
||||
}
|
||||
Assertions.assertEquals(PositionVector.Direction.NONE,moveList.nextMove());
|
||||
for (int i = 0; i < 40; i++) {
|
||||
moveList.nextMove();
|
||||
}
|
||||
Assertions.assertNull(moveList.nextMove());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user