Sfoglia il codice sorgente

Merge pull request #1459 from hgvanpariya/robot-simulator

robot-simulator: remove `final` from tests #1453
FridaTveit 6 anni fa
parent
commit
5a91750d47
No account linked to committer's email
1 ha cambiato i file con 45 aggiunte e 45 eliminazioni
  1. 45
    45
      exercises/robot-simulator/src/test/java/RobotTest.java

+ 45
- 45
exercises/robot-simulator/src/test/java/RobotTest.java Vedi File

@@ -7,9 +7,9 @@ public class RobotTest {
7 7
 
8 8
     @Test
9 9
     public void robotIsCreatedWithInitialPositionAndOrientation() {
10
-        final Orientation initialOrientation = Orientation.NORTH;
11
-        final GridPosition initialGridPosition = new GridPosition(0, 0);
12
-        final Robot robot = new Robot(initialGridPosition, initialOrientation);
10
+        Orientation initialOrientation = Orientation.NORTH;
11
+        GridPosition initialGridPosition = new GridPosition(0, 0);
12
+        Robot robot = new Robot(initialGridPosition, initialOrientation);
13 13
 
14 14
         assertEquals(robot.getOrientation(), initialOrientation);
15 15
         assertEquals(robot.getGridPosition(), initialGridPosition);
@@ -18,9 +18,9 @@ public class RobotTest {
18 18
     @Ignore("Remove to run test")
19 19
     @Test
20 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
+        GridPosition initialGridPosition = new GridPosition(-1, -1);
22
+        Orientation initialOrientation = Orientation.SOUTH;
23
+        Robot robot = new Robot(initialGridPosition, initialOrientation);
24 24
 
25 25
         assertEquals(robot.getOrientation(), initialOrientation);
26 26
         assertEquals(robot.getGridPosition(), initialGridPosition);
@@ -29,8 +29,8 @@ public class RobotTest {
29 29
     @Ignore("Remove to run test")
30 30
     @Test
31 31
     public void testTurningRightDoesNotChangePosition() {
32
-        final GridPosition initialGridPosition = new GridPosition(0, 0);
33
-        final Robot robot = new Robot(initialGridPosition, Orientation.NORTH);
32
+        GridPosition initialGridPosition = new GridPosition(0, 0);
33
+        Robot robot = new Robot(initialGridPosition, Orientation.NORTH);
34 34
 
35 35
         robot.turnRight();
36 36
 
@@ -40,11 +40,11 @@ public class RobotTest {
40 40
     @Ignore("Remove to run test")
41 41
     @Test
42 42
     public void testTurningRightCorrectlyChangesOrientationFromNorthToEast() {
43
-        final Robot robot = new Robot(new GridPosition(0, 0), Orientation.NORTH);
43
+        Robot robot = new Robot(new GridPosition(0, 0), Orientation.NORTH);
44 44
 
45 45
         robot.turnRight();
46 46
 
47
-        final Orientation expectedOrientation = Orientation.EAST;
47
+        Orientation expectedOrientation = Orientation.EAST;
48 48
 
49 49
         assertEquals(robot.getOrientation(), expectedOrientation);
50 50
     }
@@ -52,11 +52,11 @@ public class RobotTest {
52 52
     @Ignore("Remove to run test")
53 53
     @Test
54 54
     public void testTurningRightCorrectlyChangesOrientationFromEastToSouth() {
55
-        final Robot robot = new Robot(new GridPosition(0, 0), Orientation.EAST);
55
+        Robot robot = new Robot(new GridPosition(0, 0), Orientation.EAST);
56 56
 
57 57
         robot.turnRight();
58 58
 
59
-        final Orientation expectedOrientation = Orientation.SOUTH;
59
+        Orientation expectedOrientation = Orientation.SOUTH;
60 60
 
61 61
         assertEquals(robot.getOrientation(), expectedOrientation);
62 62
     }
@@ -64,11 +64,11 @@ public class RobotTest {
64 64
     @Ignore("Remove to run test")
65 65
     @Test
66 66
     public void testTurningRightCorrectlyChangesOrientationFromSouthToWest() {
67
-        final Robot robot = new Robot(new GridPosition(0, 0), Orientation.SOUTH);
67
+        Robot robot = new Robot(new GridPosition(0, 0), Orientation.SOUTH);
68 68
 
69 69
         robot.turnRight();
70 70
 
71
-        final Orientation expectedOrientation = Orientation.WEST;
71
+        Orientation expectedOrientation = Orientation.WEST;
72 72
 
73 73
         assertEquals(robot.getOrientation(), expectedOrientation);
74 74
     }
@@ -76,11 +76,11 @@ public class RobotTest {
76 76
     @Ignore("Remove to run test")
77 77
     @Test
78 78
     public void testTurningRightCorrectlyChangesOrientationFromWestToNorth() {
79
-        final Robot robot = new Robot(new GridPosition(0, 0), Orientation.WEST);
79
+        Robot robot = new Robot(new GridPosition(0, 0), Orientation.WEST);
80 80
 
81 81
         robot.turnRight();
82 82
 
83
-        final Orientation expectedOrientation = Orientation.NORTH;
83
+        Orientation expectedOrientation = Orientation.NORTH;
84 84
 
85 85
         assertEquals(robot.getOrientation(), expectedOrientation);
86 86
     }
@@ -88,8 +88,8 @@ public class RobotTest {
88 88
     @Ignore("Remove to run test")
89 89
     @Test
90 90
     public void testTurningLeftDoesNotChangePosition() {
91
-        final GridPosition initialGridPosition = new GridPosition(0, 0);
92
-        final Robot robot = new Robot(initialGridPosition, Orientation.NORTH);
91
+        GridPosition initialGridPosition = new GridPosition(0, 0);
92
+        Robot robot = new Robot(initialGridPosition, Orientation.NORTH);
93 93
 
94 94
         robot.turnLeft();
95 95
 
@@ -99,11 +99,11 @@ public class RobotTest {
99 99
     @Ignore("Remove to run test")
100 100
     @Test
101 101
     public void testTurningLeftCorrectlyChangesOrientationFromNorthToWest() {
102
-        final Robot robot = new Robot(new GridPosition(0, 0), Orientation.NORTH);
102
+        Robot robot = new Robot(new GridPosition(0, 0), Orientation.NORTH);
103 103
 
104 104
         robot.turnLeft();
105 105
 
106
-        final Orientation expectedOrientation = Orientation.WEST;
106
+        Orientation expectedOrientation = Orientation.WEST;
107 107
 
108 108
         assertEquals(robot.getOrientation(), expectedOrientation);
109 109
     }
@@ -111,11 +111,11 @@ public class RobotTest {
111 111
     @Ignore("Remove to run test")
112 112
     @Test
113 113
     public void testTurningLeftCorrectlyChangesOrientationFromWestToSouth() {
114
-        final Robot robot = new Robot(new GridPosition(0, 0), Orientation.WEST);
114
+        Robot robot = new Robot(new GridPosition(0, 0), Orientation.WEST);
115 115
 
116 116
         robot.turnLeft();
117 117
 
118
-        final Orientation expectedOrientation = Orientation.SOUTH;
118
+        Orientation expectedOrientation = Orientation.SOUTH;
119 119
 
120 120
         assertEquals(robot.getOrientation(), expectedOrientation);
121 121
     }
@@ -123,11 +123,11 @@ public class RobotTest {
123 123
     @Ignore("Remove to run test")
124 124
     @Test
125 125
     public void testTurningLeftCorrectlyChangesOrientationFromSouthToEast() {
126
-        final Robot robot = new Robot(new GridPosition(0, 0), Orientation.SOUTH);
126
+        Robot robot = new Robot(new GridPosition(0, 0), Orientation.SOUTH);
127 127
 
128 128
         robot.turnLeft();
129 129
 
130
-        final Orientation expectedOrientation = Orientation.EAST;
130
+        Orientation expectedOrientation = Orientation.EAST;
131 131
 
132 132
         assertEquals(robot.getOrientation(), expectedOrientation);
133 133
     }
@@ -135,11 +135,11 @@ public class RobotTest {
135 135
     @Ignore("Remove to run test")
136 136
     @Test
137 137
     public void testTurningLeftCorrectlyChangesOrientationFromEastToNorth() {
138
-        final Robot robot = new Robot(new GridPosition(0, 0), Orientation.EAST);
138
+        Robot robot = new Robot(new GridPosition(0, 0), Orientation.EAST);
139 139
 
140 140
         robot.turnLeft();
141 141
 
142
-        final Orientation expectedOrientation = Orientation.NORTH;
142
+        Orientation expectedOrientation = Orientation.NORTH;
143 143
 
144 144
         assertEquals(robot.getOrientation(), expectedOrientation);
145 145
     }
@@ -147,8 +147,8 @@ public class RobotTest {
147 147
     @Ignore("Remove to run test")
148 148
     @Test
149 149
     public void testAdvancingDoesNotChangeOrientation() {
150
-        final Orientation initialOrientation = Orientation.NORTH;
151
-        final Robot robot = new Robot(new GridPosition(0, 0), initialOrientation);
150
+        Orientation initialOrientation = Orientation.NORTH;
151
+        Robot robot = new Robot(new GridPosition(0, 0), initialOrientation);
152 152
 
153 153
         robot.advance();
154 154
 
@@ -158,11 +158,11 @@ public class RobotTest {
158 158
     @Ignore("Remove to run test")
159 159
     @Test
160 160
     public void testAdvancingWhenFacingNorthIncreasesYCoordinateByOne() {
161
-        final Robot robot = new Robot(new GridPosition(0, 0), Orientation.NORTH);
161
+        Robot robot = new Robot(new GridPosition(0, 0), Orientation.NORTH);
162 162
 
163 163
         robot.advance();
164 164
 
165
-        final GridPosition expectedGridPosition = new GridPosition(0, 1);
165
+        GridPosition expectedGridPosition = new GridPosition(0, 1);
166 166
 
167 167
         assertEquals(robot.getGridPosition(), expectedGridPosition);
168 168
     }
@@ -170,11 +170,11 @@ public class RobotTest {
170 170
     @Ignore("Remove to run test")
171 171
     @Test
172 172
     public void testAdvancingWhenFacingSouthDecreasesYCoordinateByOne() {
173
-        final Robot robot = new Robot(new GridPosition(0, 0), Orientation.SOUTH);
173
+        Robot robot = new Robot(new GridPosition(0, 0), Orientation.SOUTH);
174 174
 
175 175
         robot.advance();
176 176
 
177
-        final GridPosition expectedGridPosition = new GridPosition(0, -1);
177
+        GridPosition expectedGridPosition = new GridPosition(0, -1);
178 178
 
179 179
         assertEquals(robot.getGridPosition(), expectedGridPosition);
180 180
     }
@@ -182,11 +182,11 @@ public class RobotTest {
182 182
     @Ignore("Remove to run test")
183 183
     @Test
184 184
     public void testAdvancingWhenFacingEastIncreasesXCoordinateByOne() {
185
-        final Robot robot = new Robot(new GridPosition(0, 0), Orientation.EAST);
185
+        Robot robot = new Robot(new GridPosition(0, 0), Orientation.EAST);
186 186
 
187 187
         robot.advance();
188 188
 
189
-        final GridPosition expectedGridPosition = new GridPosition(1, 0);
189
+        GridPosition expectedGridPosition = new GridPosition(1, 0);
190 190
 
191 191
         assertEquals(robot.getGridPosition(), expectedGridPosition);
192 192
     }
@@ -194,11 +194,11 @@ public class RobotTest {
194 194
     @Ignore("Remove to run test")
195 195
     @Test
196 196
     public void testAdvancingWhenFacingWestDecreasesXCoordinateByOne() {
197
-        final Robot robot = new Robot(new GridPosition(0, 0), Orientation.WEST);
197
+        Robot robot = new Robot(new GridPosition(0, 0), Orientation.WEST);
198 198
 
199 199
         robot.advance();
200 200
 
201
-        final GridPosition expectedGridPosition = new GridPosition(-1, 0);
201
+        GridPosition expectedGridPosition = new GridPosition(-1, 0);
202 202
 
203 203
         assertEquals(robot.getGridPosition(), expectedGridPosition);
204 204
     }
@@ -206,12 +206,12 @@ public class RobotTest {
206 206
     @Ignore("Remove to run test")
207 207
     @Test
208 208
     public void testInstructionsToMoveWestAndNorth() {
209
-        final Robot robot = new Robot(new GridPosition(0, 0), Orientation.NORTH);
209
+        Robot robot = new Robot(new GridPosition(0, 0), Orientation.NORTH);
210 210
 
211 211
         robot.simulate("LAAARALA");
212 212
 
213
-        final GridPosition expectedGridPosition = new GridPosition(-4, 1);
214
-        final Orientation expectedOrientation = Orientation.WEST;
213
+        GridPosition expectedGridPosition = new GridPosition(-4, 1);
214
+        Orientation expectedOrientation = Orientation.WEST;
215 215
 
216 216
         assertEquals(robot.getGridPosition(), expectedGridPosition);
217 217
         assertEquals(robot.getOrientation(), expectedOrientation);
@@ -220,12 +220,12 @@ public class RobotTest {
220 220
     @Ignore("Remove to run test")
221 221
     @Test
222 222
     public void testInstructionsToMoveWestAndSouth() {
223
-        final Robot robot = new Robot(new GridPosition(2, -7), Orientation.EAST);
223
+        Robot robot = new Robot(new GridPosition(2, -7), Orientation.EAST);
224 224
 
225 225
         robot.simulate("RRAAAAALA");
226 226
 
227
-        final GridPosition expectedGridPosition = new GridPosition(-3, -8);
228
-        final Orientation expectedOrientation = Orientation.SOUTH;
227
+        GridPosition expectedGridPosition = new GridPosition(-3, -8);
228
+        Orientation expectedOrientation = Orientation.SOUTH;
229 229
 
230 230
         assertEquals(robot.getGridPosition(), expectedGridPosition);
231 231
         assertEquals(robot.getOrientation(), expectedOrientation);
@@ -234,12 +234,12 @@ public class RobotTest {
234 234
     @Ignore("Remove to run test")
235 235
     @Test
236 236
     public void testInstructionsToMoveEastAndNorth() {
237
-        final Robot robot = new Robot(new GridPosition(8, 4), Orientation.SOUTH);
237
+        Robot robot = new Robot(new GridPosition(8, 4), Orientation.SOUTH);
238 238
 
239 239
         robot.simulate("LAAARRRALLLL");
240 240
 
241
-        final GridPosition expectedGridPosition = new GridPosition(11, 5);
242
-        final Orientation expectedOrientation = Orientation.NORTH;
241
+        GridPosition expectedGridPosition = new GridPosition(11, 5);
242
+        Orientation expectedOrientation = Orientation.NORTH;
243 243
 
244 244
         assertEquals(robot.getGridPosition(), expectedGridPosition);
245 245
         assertEquals(robot.getOrientation(), expectedOrientation);