|
|
@@ -6,20 +6,24 @@ import static org.junit.Assert.assertEquals;
|
|
6
|
6
|
public class RobotTest {
|
|
7
|
7
|
|
|
8
|
8
|
@Test
|
|
9
|
|
- public void testRobotIsCreatedWithCorrectInitialPosition() {
|
|
|
9
|
+ public void testRobotIsCreatedWithCorrectInitialPositionAndOrientation() {
|
|
|
10
|
+ final Orientation initialOrientation = Orientation.NORTH;
|
|
10
|
11
|
final GridPosition initialGridPosition = new GridPosition(0, 0);
|
|
11
|
|
- final Robot robot = new Robot(initialGridPosition, Orientation.NORTH);
|
|
|
12
|
+ final Robot robot = new Robot(initialGridPosition, initialOrientation);
|
|
12
|
13
|
|
|
|
14
|
+ assertEquals(robot.getOrientation(), initialOrientation);
|
|
13
|
15
|
assertEquals(robot.getGridPosition(), initialGridPosition);
|
|
14
|
16
|
}
|
|
15
|
17
|
|
|
16
|
18
|
@Ignore("Remove to run test")
|
|
17
|
19
|
@Test
|
|
18
|
|
- public void testRobotIsCreatedWithCorrectInitialOrientation() {
|
|
19
|
|
- final Orientation initialOrientation = Orientation.NORTH;
|
|
20
|
|
- final Robot robot = new Robot(new GridPosition(0, 0), initialOrientation);
|
|
|
20
|
+ public void testNegativePositionsAreAllowed() {
|
|
|
21
|
+ final GridPosition initialGridPosition = new GridPosition(-1, -1);
|
|
|
22
|
+ final Orientation initialOrientation = Orientation.SOUTH;
|
|
|
23
|
+ final Robot robot = new Robot(initialGridPosition, initialOrientation);
|
|
21
|
24
|
|
|
22
|
25
|
assertEquals(robot.getOrientation(), initialOrientation);
|
|
|
26
|
+ assertEquals(robot.getGridPosition(), initialGridPosition);
|
|
23
|
27
|
}
|
|
24
|
28
|
|
|
25
|
29
|
@Ignore("Remove to run test")
|