Skip to content

Commit 354ef47

Browse files
authored
Refactor method names to remove snake_case (#3030)
Also: - Update Checkstyle to check for _ in method names - Fix broken link in CONTRIBUTING.md [no important files changed]
1 parent 5d2268c commit 354ef47

File tree

11 files changed

+103
-103
lines changed

11 files changed

+103
-103
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ Each problem/submodule has three source sets:
209209

210210
### Update/sync Gradle versions
211211

212-
Please read [How to Update Gradle](../reference/how-to-update-gradle.md)
212+
Please read [How to Update Gradle](reference/how-to-update-gradle.md)
213213

214214
## Contributing to Concept Exercises
215215

exercises/checkstyle.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ page at http://checkstyle.sourceforge.net/config.html -->
155155
<module name="MethodNameCheck">
156156
<!-- Validates identifiers for method names. -->
157157
<metadata name="altname" value="MethodName" />
158-
<property name="format" value="^[a-z][a-zA-Z0-9]*(_[a-zA-Z0-9]+)*$" />
158+
<property name="format" value="^[a-z][a-zA-Z0-9]*$" />
159159
<property name="severity" value="error" />
160160
</module>
161161

exercises/concept/annalyns-infiltration/src/test/java/AnnalynsInfiltrationTest.java

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ public class AnnalynsInfiltrationTest {
99
@Test
1010
@Tag("task:1")
1111
@DisplayName("The canFastAttack method returns false when knight is awake")
12-
public void cannot_execute_fast_attack_if_knight_is_awake() {
12+
public void cannotExecuteFastAttackIfKnightIsAwake() {
1313
boolean knightIsAwake = true;
1414
assertThat(AnnalynsInfiltration.canFastAttack(knightIsAwake)).isFalse();
1515
}
1616

1717
@Test
1818
@Tag("task:1")
1919
@DisplayName("The canFastAttack method returns true when knight is sleeping")
20-
public void can_execute_fast_attack_if_knight_is_sleeping() {
20+
public void canExecuteFastAttackIfKnightIsSleeping() {
2121
boolean knightIsAwake = false;
2222
assertThat(AnnalynsInfiltration.canFastAttack(knightIsAwake)).isTrue();
2323
}
2424

2525
@Test
2626
@Tag("task:2")
2727
@DisplayName("The canSpy method returns false when everyone is sleeping")
28-
public void cannot_spy_if_everyone_is_sleeping() {
28+
public void cannotSpyIfEveryoneIsSleeping() {
2929
boolean knightIsAwake = false;
3030
boolean archerIsAwake = false;
3131
boolean prisonerIsAwake = false;
@@ -35,7 +35,7 @@ public void cannot_spy_if_everyone_is_sleeping() {
3535
@Test
3636
@Tag("task:2")
3737
@DisplayName("The canSpy method returns true when everyone but knight is sleeping")
38-
public void can_spy_if_everyone_but_knight_is_sleeping() {
38+
public void canSpyIfEveryoneButKnightIsSleeping() {
3939
boolean knightIsAwake = true;
4040
boolean archerIsAwake = false;
4141
boolean prisonerIsAwake = false;
@@ -45,7 +45,7 @@ public void can_spy_if_everyone_but_knight_is_sleeping() {
4545
@Test
4646
@Tag("task:2")
4747
@DisplayName("The canSpy method returns true when everyone but archer is sleeping")
48-
public void can_spy_if_everyone_but_archer_is_sleeping() {
48+
public void canSpyIfEveryoneButArcherIsSleeping() {
4949
boolean knightIsAwake = false;
5050
boolean archerIsAwake = true;
5151
boolean prisonerIsAwake = false;
@@ -55,7 +55,7 @@ public void can_spy_if_everyone_but_archer_is_sleeping() {
5555
@Test
5656
@Tag("task:2")
5757
@DisplayName("The canSpy method returns true when everyone but prisoner is sleeping")
58-
public void can_spy_if_everyone_but_prisoner_is_sleeping() {
58+
public void canSpyIfEveryoneButPrisonerIsSleeping() {
5959
boolean knightIsAwake = false;
6060
boolean archerIsAwake = false;
6161
boolean prisonerIsAwake = true;
@@ -65,7 +65,7 @@ public void can_spy_if_everyone_but_prisoner_is_sleeping() {
6565
@Test
6666
@Tag("task:2")
6767
@DisplayName("The canSpy method returns true when only knight is sleeping")
68-
public void can_spy_if_only_knight_is_sleeping() {
68+
public void canSpyIfOnlyKnightIsSleeping() {
6969
boolean knightIsAwake = false;
7070
boolean archerIsAwake = true;
7171
boolean prisonerIsAwake = true;
@@ -75,7 +75,7 @@ public void can_spy_if_only_knight_is_sleeping() {
7575
@Test
7676
@Tag("task:2")
7777
@DisplayName("The canSpy method returns true when only archer is sleeping")
78-
public void can_spy_if_only_archer_is_sleeping() {
78+
public void canSpyIfOnlyArcherIsSleeping() {
7979
boolean knightIsAwake = true;
8080
boolean archerIsAwake = false;
8181
boolean prisonerIsAwake = true;
@@ -85,7 +85,7 @@ public void can_spy_if_only_archer_is_sleeping() {
8585
@Test
8686
@Tag("task:2")
8787
@DisplayName("The canSpy method returns true when only prisoner is sleeping")
88-
public void can_spy_if_only_prisoner_is_sleeping() {
88+
public void canSpyIfOnlyPrisonerIsSleeping() {
8989
boolean knightIsAwake = true;
9090
boolean archerIsAwake = true;
9191
boolean prisonerIsAwake = false;
@@ -95,7 +95,7 @@ public void can_spy_if_only_prisoner_is_sleeping() {
9595
@Test
9696
@Tag("task:2")
9797
@DisplayName("The canSpy method returns true when everyone is awake")
98-
public void can_spy_if_everyone_is_awake() {
98+
public void canSpyIfEveryoneIsAwake() {
9999
boolean knightIsAwake = true;
100100
boolean archerIsAwake = true;
101101
boolean prisonerIsAwake = true;
@@ -105,7 +105,7 @@ public void can_spy_if_everyone_is_awake() {
105105
@Test
106106
@Tag("task:3")
107107
@DisplayName("The canSignalPrisoner method returns true when prisoner is awake and archer is sleeping")
108-
public void can_signal_prisoner_if_archer_is_sleeping_and_prisoner_is_awake() {
108+
public void canSignalPrisonerIfArcherIsSleepingAndPrisonerIsAwake() {
109109
boolean archerIsAwake = false;
110110
boolean prisonerIsAwake = true;
111111
assertThat(AnnalynsInfiltration.canSignalPrisoner(archerIsAwake, prisonerIsAwake)).isTrue();
@@ -114,7 +114,7 @@ public void can_signal_prisoner_if_archer_is_sleeping_and_prisoner_is_awake() {
114114
@Test
115115
@Tag("task:3")
116116
@DisplayName("The canSignalPrisoner method returns false when prisoner is sleeping and archer is awake")
117-
public void cannot_signal_prisoner_if_archer_is_awake_and_prisoner_is_sleeping() {
117+
public void cannotSignalPrisonerIfArcherIsAwakeAndPrisonerIsSleeping() {
118118
boolean archerIsAwake = true;
119119
boolean prisonerIsAwake = false;
120120
assertThat(AnnalynsInfiltration.canSignalPrisoner(archerIsAwake, prisonerIsAwake)).isFalse();
@@ -123,7 +123,7 @@ public void cannot_signal_prisoner_if_archer_is_awake_and_prisoner_is_sleeping()
123123
@Test
124124
@Tag("task:3")
125125
@DisplayName("The canSignalPrisoner method returns false when both prisoner and archer are sleeping")
126-
public void cannot_signal_prisoner_if_archer_and_prisoner_are_both_sleeping() {
126+
public void cannotSignalPrisonerIfArcherAndPrisonerAreBothSleeping() {
127127
boolean archerIsAwake = false;
128128
boolean prisonerIsAwake = false;
129129
assertThat(AnnalynsInfiltration.canSignalPrisoner(archerIsAwake, prisonerIsAwake)).isFalse();
@@ -132,7 +132,7 @@ public void cannot_signal_prisoner_if_archer_and_prisoner_are_both_sleeping() {
132132
@Test
133133
@Tag("task:3")
134134
@DisplayName("The canSignalPrisoner method returns false when both prisoner and archer are awake")
135-
public void cannot_signal_prisoner_if_archer_and_prisoner_are_both_awake() {
135+
public void cannotSignalPrisonerIfArcherAndPrisonerAreBothAwake() {
136136
boolean archerIsAwake = true;
137137
boolean prisonerIsAwake = true;
138138
assertThat(AnnalynsInfiltration.canSignalPrisoner(archerIsAwake, prisonerIsAwake)).isFalse();
@@ -141,7 +141,7 @@ public void cannot_signal_prisoner_if_archer_and_prisoner_are_both_awake() {
141141
@Test
142142
@Tag("task:4")
143143
@DisplayName("The canFreePrisoner method returns false when everyone is awake and pet dog is present")
144-
public void cannot_release_prisoner_if_everyone_is_awake_and_pet_dog_is_present() {
144+
public void cannotReleasePrisonerIfEveryoneIsAwakeAndPetDogIsPresent() {
145145
boolean knightIsAwake = true;
146146
boolean archerIsAwake = true;
147147
boolean prisonerIsAwake = true;
@@ -153,7 +153,7 @@ public void cannot_release_prisoner_if_everyone_is_awake_and_pet_dog_is_present(
153153
@Test
154154
@Tag("task:4")
155155
@DisplayName("The canFreePrisoner method returns false when everyone is awake and pet dog is absent")
156-
public void cannot_release_prisoner_if_everyone_is_awake_and_pet_dog_is_absent() {
156+
public void cannotReleasePrisonerIfEveryoneIsAwakeAndPetDogIsAbsent() {
157157
boolean knightIsAwake = true;
158158
boolean archerIsAwake = true;
159159
boolean prisonerIsAwake = true;
@@ -165,7 +165,7 @@ public void cannot_release_prisoner_if_everyone_is_awake_and_pet_dog_is_absent()
165165
@Test
166166
@Tag("task:4")
167167
@DisplayName("The canFreePrisoner method returns true when everyone is sleeping and pet dog is present")
168-
public void can_release_prisoner_if_everyone_is_asleep_and_pet_dog_is_present() {
168+
public void canReleasePrisonerIfEveryoneIsAsleepAndPetDogIsPresent() {
169169
boolean knightIsAwake = false;
170170
boolean archerIsAwake = false;
171171
boolean prisonerIsAwake = false;
@@ -177,7 +177,7 @@ public void can_release_prisoner_if_everyone_is_asleep_and_pet_dog_is_present()
177177
@Test
178178
@Tag("task:4")
179179
@DisplayName("The canFreePrisoner method returns false when everyone is sleeping and pet dog is absent")
180-
public void cannot_release_prisoner_if_everyone_is_asleep_and_pet_dog_is_absent() {
180+
public void cannotReleasePrisonerIfEveryoneIsAsleepAndPetDogIsAbsent() {
181181
boolean knightIsAwake = false;
182182
boolean archerIsAwake = false;
183183
boolean prisonerIsAwake = false;
@@ -189,7 +189,7 @@ public void cannot_release_prisoner_if_everyone_is_asleep_and_pet_dog_is_absent(
189189
@Test
190190
@Tag("task:4")
191191
@DisplayName("The canFreePrisoner method returns true when only prisoner is awake and pet dog is present")
192-
public void can_release_prisoner_if_only_prisoner_is_awake_and_pet_dog_is_present() {
192+
public void canReleasePrisonerIfOnlyPrisonerIsAwakeAndPetDogIsPresent() {
193193
boolean knightIsAwake = false;
194194
boolean archerIsAwake = false;
195195
boolean prisonerIsAwake = true;
@@ -201,7 +201,7 @@ public void can_release_prisoner_if_only_prisoner_is_awake_and_pet_dog_is_presen
201201
@Test
202202
@Tag("task:4")
203203
@DisplayName("The canFreePrisoner method returns true when only prisoner is awake and pet dog is absent")
204-
public void can_release_prisoner_if_only_prisoner_is_awake_and_pet_dog_is_absent() {
204+
public void canReleasePrisonerIfOnlyPrisonerIsAwakeAndPetDogIsAbsent() {
205205
boolean knightIsAwake = false;
206206
boolean archerIsAwake = false;
207207
boolean prisonerIsAwake = true;
@@ -213,7 +213,7 @@ public void can_release_prisoner_if_only_prisoner_is_awake_and_pet_dog_is_absent
213213
@Test
214214
@Tag("task:4")
215215
@DisplayName("The canFreePrisoner method returns false when only archer is awake and pet dog is present")
216-
public void cannot_release_prisoner_if_only_archer_is_awake_and_pet_dog_is_present() {
216+
public void cannotReleasePrisonerIfOnlyArcherIsAwakeAndPetDogIsPresent() {
217217
boolean knightIsAwake = false;
218218
boolean archerIsAwake = true;
219219
boolean prisonerIsAwake = false;
@@ -225,7 +225,7 @@ public void cannot_release_prisoner_if_only_archer_is_awake_and_pet_dog_is_prese
225225
@Test
226226
@Tag("task:4")
227227
@DisplayName("The canFreePrisoner method returns false when only archer is awake and pet dog is absent")
228-
public void cannot_release_prisoner_if_only_archer_is_awake_and_pet_dog_is_absent() {
228+
public void cannotReleasePrisonerIfOnlyArcherIsAwakeAndPetDogIsAbsent() {
229229
boolean knightIsAwake = false;
230230
boolean archerIsAwake = true;
231231
boolean prisonerIsAwake = false;
@@ -237,7 +237,7 @@ public void cannot_release_prisoner_if_only_archer_is_awake_and_pet_dog_is_absen
237237
@Test
238238
@Tag("task:4")
239239
@DisplayName("The canFreePrisoner method returns true when only knight is awake and pet dog is present")
240-
public void can_release_prisoner_if_only_knight_is_awake_and_pet_dog_is_present() {
240+
public void canReleasePrisonerIfOnlyKnightIsAwakeAndPetDogIsPresent() {
241241
boolean knightIsAwake = true;
242242
boolean archerIsAwake = false;
243243
boolean prisonerIsAwake = false;
@@ -249,7 +249,7 @@ public void can_release_prisoner_if_only_knight_is_awake_and_pet_dog_is_present(
249249
@Test
250250
@Tag("task:4")
251251
@DisplayName("The canFreePrisoner method returns false when only knight is awake and pet dog is absent")
252-
public void cannot_release_prisoner_if_only_knight_is_awake_and_pet_dog_is_absent() {
252+
public void cannotReleasePrisonerIfOnlyKnightIsAwakeAndPetDogIsAbsent() {
253253
boolean knightIsAwake = true;
254254
boolean archerIsAwake = false;
255255
boolean prisonerIsAwake = false;
@@ -261,7 +261,7 @@ public void cannot_release_prisoner_if_only_knight_is_awake_and_pet_dog_is_absen
261261
@Test
262262
@Tag("task:4")
263263
@DisplayName("The canFreePrisoner method returns false when only knight is sleeping and pet dog is present")
264-
public void cannot_release_prisoner_if_only_knight_is_asleep_and_pet_dog_is_present() {
264+
public void cannotReleasePrisonerIfOnlyKnightIsAsleepAndPetDogIsPresent() {
265265
boolean knightIsAwake = false;
266266
boolean archerIsAwake = true;
267267
boolean prisonerIsAwake = true;
@@ -273,7 +273,7 @@ public void cannot_release_prisoner_if_only_knight_is_asleep_and_pet_dog_is_pres
273273
@Test
274274
@Tag("task:4")
275275
@DisplayName("The canFreePrisoner method returns false when only knight is sleeping and pet dog is absent")
276-
public void cannot_release_prisoner_if_only_knight_is_asleep_and_pet_dog_is_absent() {
276+
public void cannotReleasePrisonerIfOnlyKnightIsAsleepAndPetDogIsAbsent() {
277277
boolean knightIsAwake = false;
278278
boolean archerIsAwake = true;
279279
boolean prisonerIsAwake = true;
@@ -285,7 +285,7 @@ public void cannot_release_prisoner_if_only_knight_is_asleep_and_pet_dog_is_abse
285285
@Test
286286
@Tag("task:4")
287287
@DisplayName("The canFreePrisoner method returns true when only archer is sleeping and pet dog is present")
288-
public void can_release_prisoner_if_only_archer_is_asleep_and_pet_dog_is_present() {
288+
public void canReleasePrisonerIfOnlyArcherIsAsleepAndPetDogIsPresent() {
289289
boolean knightIsAwake = true;
290290
boolean archerIsAwake = false;
291291
boolean prisonerIsAwake = true;
@@ -297,7 +297,7 @@ public void can_release_prisoner_if_only_archer_is_asleep_and_pet_dog_is_present
297297
@Test
298298
@Tag("task:4")
299299
@DisplayName("The canFreePrisoner method returns false when only archer is sleeping and pet dog is absent")
300-
public void cannot_release_prisoner_if_only_archer_is_asleep_and_pet_dog_is_absent() {
300+
public void cannotReleasePrisonerIfOnlyArcherIsAsleepAndPetDogIsAbsent() {
301301
boolean knightIsAwake = true;
302302
boolean archerIsAwake = false;
303303
boolean prisonerIsAwake = true;
@@ -309,7 +309,7 @@ public void cannot_release_prisoner_if_only_archer_is_asleep_and_pet_dog_is_abse
309309
@Test
310310
@Tag("task:4")
311311
@DisplayName("The canFreePrisoner method returns false when only prisoner is sleeping and pet dog is present")
312-
public void cannot_release_prisoner_if_only_prisoner_is_asleep_and_pet_dog_is_present() {
312+
public void cannotReleasePrisonerIfOnlyPrisonerIsAsleepAndPetDogIsPresent() {
313313
boolean knightIsAwake = true;
314314
boolean archerIsAwake = true;
315315
boolean prisonerIsAwake = false;
@@ -321,7 +321,7 @@ public void cannot_release_prisoner_if_only_prisoner_is_asleep_and_pet_dog_is_pr
321321
@Test
322322
@Tag("task:4")
323323
@DisplayName("The canFreePrisoner method returns false when only prisoner is sleeping and pet dog is absent")
324-
public void cannot_release_prisoner_if_only_prisoner_is_asleep_and_pet_dog_is_absent() {
324+
public void cannotReleasePrisonerIfOnlyPrisonerIsAsleepAndPetDogIsAbsent() {
325325
boolean knightIsAwake = true;
326326
boolean archerIsAwake = true;
327327
boolean prisonerIsAwake = false;

exercises/concept/football-match-reports/src/test/java/FootballMatchReportsTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,36 @@ public class FootballMatchReportsTest {
99
@Test
1010
@Tag("task:1")
1111
@DisplayName("The onField method returns the correct description of player with shirt number 1")
12-
public void test_goal() {
12+
public void testGoal() {
1313
assertThat(FootballMatchReports.onField(1)).isEqualTo("goalie");
1414
}
1515

1616
@Test
1717
@Tag("task:1")
1818
@DisplayName("The onField method returns the correct description of player with shirt number 2")
19-
public void test_left_back() {
19+
public void testLeftBack() {
2020
assertThat(FootballMatchReports.onField(2)).isEqualTo("left back");
2121
}
2222

2323
@Test
2424
@Tag("task:1")
2525
@DisplayName("The onField method returns the correct description of player with shirt number 5")
26-
public void test_right_back() {
26+
public void testRightBack() {
2727
assertThat(FootballMatchReports.onField(5)).isEqualTo("right back");
2828
}
2929

3030
@Test
3131
@Tag("task:1")
3232
@DisplayName("The onField method returns the correct description of players with shirt numbers 3 and 4")
33-
public void test_center_back() {
33+
public void testCenterBack() {
3434
assertThat(FootballMatchReports.onField(3)).isEqualTo("center back");
3535
assertThat(FootballMatchReports.onField(4)).isEqualTo("center back");
3636
}
3737

3838
@Test
3939
@Tag("task:1")
4040
@DisplayName("The onField method returns the correct description of players with shirt numbers 6, 7 and 8")
41-
public void test_midfielder() {
41+
public void testMidfielder() {
4242
assertThat(FootballMatchReports.onField(6)).isEqualTo("midfielder");
4343
assertThat(FootballMatchReports.onField(7)).isEqualTo("midfielder");
4444
assertThat(FootballMatchReports.onField(8)).isEqualTo("midfielder");
@@ -47,35 +47,35 @@ public void test_midfielder() {
4747
@Test
4848
@Tag("task:1")
4949
@DisplayName("The onField method returns the correct description of player with shirt number 9")
50-
public void test_left_wing() {
50+
public void testLeftWing() {
5151
assertThat(FootballMatchReports.onField(9)).isEqualTo("left wing");
5252
}
5353

5454
@Test
5555
@Tag("task:1")
5656
@DisplayName("The onField method returns the correct description of player with shirt number 10")
57-
public void test_striker() {
57+
public void testStriker() {
5858
assertThat(FootballMatchReports.onField(10)).isEqualTo("striker");
5959
}
6060

6161
@Test
6262
@Tag("task:1")
6363
@DisplayName("The onField method returns the correct description of player with shirt number 11")
64-
public void test_right_wing() {
64+
public void testRightWing() {
6565
assertThat(FootballMatchReports.onField(11)).isEqualTo("right wing");
6666
}
6767

6868
@Test
6969
@Tag("task:2")
7070
@DisplayName("The onField method returns 'invalid' for invalid shirt number")
71-
public void test_exception() {
71+
public void testException() {
7272
assertThat(FootballMatchReports.onField(13)).isEqualTo("invalid");
7373
}
7474

7575
@Test
7676
@Tag("task:2")
7777
@DisplayName("The onField method returns 'invalid' for negative shirt number")
78-
public void test_exception_negative_number() {
78+
public void testExceptionNegativeNumber() {
7979
assertThat(FootballMatchReports.onField(-1)).isEqualTo("invalid");
8080
}
8181
}

0 commit comments

Comments
 (0)