Skip to content

Commit 47c49f2

Browse files
committed
finished with adding @DisplayName to yacht , zebraPuzzle and Zipper
1 parent 067d3ce commit 47c49f2

File tree

3 files changed

+92
-44
lines changed

3 files changed

+92
-44
lines changed

exercises/practice/yacht/src/test/java/YachtTest.java

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,207 +1,237 @@
11
import org.junit.jupiter.api.Disabled;
22
import org.junit.jupiter.api.Test;
3+
import org.junit.jupiter.api.DisplayName;
34

45
import static org.assertj.core.api.Assertions.assertThat;
56

67
public class YachtTest {
78

89
@Test
10+
@DisplayName("Yacht")
911
public void yacht() {
1012
Yacht yacht = new Yacht(new int[]{ 5, 5, 5, 5, 5 }, YachtCategory.YACHT);
1113
assertThat(yacht.score()).isEqualTo(50);
1214
}
1315

1416
@Disabled("Remove to run test")
1517
@Test
18+
@DisplayName("Not Yacht")
1619
public void notYacht() {
1720
Yacht yacht = new Yacht(new int[]{ 1, 3, 3, 2, 5 }, YachtCategory.YACHT);
1821
assertThat(yacht.score()).isEqualTo(0);
1922
}
2023

2124
@Disabled("Remove to run test")
2225
@Test
26+
@DisplayName("Ones")
2327
public void ones() {
2428
Yacht yacht = new Yacht(new int[]{ 1, 1, 1, 3, 5 }, YachtCategory.ONES);
2529
assertThat(yacht.score()).isEqualTo(3);
2630
}
2731

2832
@Disabled("Remove to run test")
2933
@Test
34+
@DisplayName("Ones, out of order")
3035
public void onesOutOfOrder() {
3136
Yacht yacht = new Yacht(new int[]{ 3, 1, 1, 5, 1 }, YachtCategory.ONES);
3237
assertThat(yacht.score()).isEqualTo(3);
3338
}
3439

3540
@Disabled("Remove to run test")
3641
@Test
42+
@DisplayName("No ones")
3743
public void noOnes() {
3844
Yacht yacht = new Yacht(new int[]{ 4, 3, 6, 5, 5 }, YachtCategory.ONES);
3945
assertThat(yacht.score()).isEqualTo(0);
4046
}
4147

4248
@Disabled("Remove to run test")
4349
@Test
50+
@DisplayName("Twos")
4451
public void twos() {
4552
Yacht yacht = new Yacht(new int[]{ 2, 3, 4, 5, 6 }, YachtCategory.TWOS);
4653
assertThat(yacht.score()).isEqualTo(2);
4754
}
4855

4956
@Disabled("Remove to run test")
5057
@Test
58+
@DisplayName("Fours")
5159
public void fours() {
5260
Yacht yacht = new Yacht(new int[]{ 1, 4, 1, 4, 1 }, YachtCategory.FOURS);
5361
assertThat(yacht.score()).isEqualTo(8);
5462
}
5563

5664
@Disabled("Remove to run test")
5765
@Test
66+
@DisplayName("Yacht of 3s counted as fives")
5867
public void yachtCountedAsThrees() {
5968
Yacht yacht = new Yacht(new int[]{ 3, 3, 3, 3, 3 }, YachtCategory.THREES);
6069
assertThat(yacht.score()).isEqualTo(15);
6170
}
6271

6372
@Disabled("Remove to run test")
6473
@Test
74+
@DisplayName("Yacht of 3s counted as fives")
6575
public void yachtOfThreesCountedAsFives() {
6676
Yacht yacht = new Yacht(new int[]{ 3, 3, 3, 3, 3 }, YachtCategory.FIVES);
6777
assertThat(yacht.score()).isEqualTo(0);
6878
}
69-
79+
7080
@Disabled("Remove to run test")
7181
@Test
82+
@DisplayName("Fives")
7283
public void fives() {
7384
Yacht yacht = new Yacht(new int[]{ 1, 5, 3, 5, 3 }, YachtCategory.FIVES);
7485
assertThat(yacht.score()).isEqualTo(10);
7586
}
7687

7788
@Disabled("Remove to run test")
7889
@Test
90+
@DisplayName("Sixes")
7991
public void sixes() {
8092
Yacht yacht = new Yacht(new int[]{ 2, 3, 4, 5, 6 }, YachtCategory.SIXES);
8193
assertThat(yacht.score()).isEqualTo(6);
8294
}
8395

8496
@Disabled("Remove to run test")
8597
@Test
98+
@DisplayName("Full house two small, three big")
8699
public void fullHouseTwoSmallThreeBig() {
87100
Yacht yacht = new Yacht(new int[]{ 2, 2, 4, 4, 4 }, YachtCategory.FULL_HOUSE);
88101
assertThat(yacht.score()).isEqualTo(16);
89102
}
90103

91104
@Disabled("Remove to run test")
92105
@Test
106+
@DisplayName("Full house three small, two big")
93107
public void fullHouseThreeSmallTwoBig() {
94108
Yacht yacht = new Yacht(new int[]{ 5, 3, 3, 5, 3 }, YachtCategory.FULL_HOUSE);
95109
assertThat(yacht.score()).isEqualTo(19);
96110
}
97111

98112
@Disabled("Remove to run test")
99113
@Test
114+
@DisplayName("Two pair is not a full house")
100115
public void twoPairIsNotAFullHouse() {
101116
Yacht yacht = new Yacht(new int[]{ 2, 2, 4, 4, 5 }, YachtCategory.FULL_HOUSE);
102117
assertThat(yacht.score()).isEqualTo(0);
103118
}
104119

105120
@Disabled("Remove to run test")
106121
@Test
122+
@DisplayName("Four of a kind is not a full house")
107123
public void fourOfAKindIsNotAFullHouse() {
108124
Yacht yacht = new Yacht(new int[]{ 1, 4, 4, 4, 4 }, YachtCategory.FULL_HOUSE);
109125
assertThat(yacht.score()).isEqualTo(0);
110126
}
111127

112128
@Disabled("Remove to run test")
113129
@Test
130+
@DisplayName("Yacht is not a full house")
114131
public void yachtIsNotAFullHouse() {
115132
Yacht yacht = new Yacht(new int[]{ 2, 2, 2, 2, 2 }, YachtCategory.FULL_HOUSE);
116133
assertThat(yacht.score()).isEqualTo(0);
117134
}
118135

119136
@Disabled("Remove to run test")
120137
@Test
138+
@DisplayName("Four of a Kind")
121139
public void fourOfAKind() {
122140
Yacht yacht = new Yacht(new int[]{ 6, 6, 4, 6, 6 }, YachtCategory.FOUR_OF_A_KIND);
123141
assertThat(yacht.score()).isEqualTo(24);
124142
}
125143

126144
@Disabled("Remove to run test")
127145
@Test
146+
@DisplayName("Yacht can be scored as Four of a Kind")
128147
public void yachtCanBeScoredAsFourOfAKind() {
129148
Yacht yacht = new Yacht(new int[]{ 3, 3, 3, 3, 3 }, YachtCategory.FOUR_OF_A_KIND);
130149
assertThat(yacht.score()).isEqualTo(12);
131150
}
132151

133152
@Disabled("Remove to run test")
134153
@Test
154+
@DisplayName("Full house is not Four of a Kind")
135155
public void fullHouseIsNotFourOfAKind() {
136156
Yacht yacht = new Yacht(new int[]{ 3, 3, 3, 5, 5 }, YachtCategory.FOUR_OF_A_KIND);
137157
assertThat(yacht.score()).isEqualTo(0);
138158
}
139159

140160
@Disabled("Remove to run test")
141161
@Test
162+
@DisplayName("Little Straight")
142163
public void littleStraight() {
143164
Yacht yacht = new Yacht(new int[]{ 3, 5, 4, 1, 2 }, YachtCategory.LITTLE_STRAIGHT);
144165
assertThat(yacht.score()).isEqualTo(30);
145166
}
146167

147168
@Disabled("Remove to run test")
148169
@Test
170+
@DisplayName("Little Straight as Big Straight")
149171
public void littleStraightAsBigStraight() {
150172
Yacht yacht = new Yacht(new int[]{ 1, 2, 3, 4, 5 }, YachtCategory.BIG_STRAIGHT);
151173
assertThat(yacht.score()).isEqualTo(0);
152174
}
153175

154176
@Disabled("Remove to run test")
155177
@Test
178+
@DisplayName("Four in order but not a little straight")
156179
public void fourInOrderButNotALittleStraight() {
157180
Yacht yacht = new Yacht(new int[]{ 1, 1, 2, 3, 4 }, YachtCategory.LITTLE_STRAIGHT);
158181
assertThat(yacht.score()).isEqualTo(0);
159182
}
160183

161184
@Disabled("Remove to run test")
162185
@Test
186+
@DisplayName("No pairs but not a little straight")
163187
public void noPairsButNotALittleStraight() {
164188
Yacht yacht = new Yacht(new int[]{ 1, 2, 3, 4, 6 }, YachtCategory.LITTLE_STRAIGHT);
165189
assertThat(yacht.score()).isEqualTo(0);
166190
}
167191

168192
@Disabled("Remove to run test")
169193
@Test
194+
@DisplayName("Minimum is 1, maximum is 5, but not a little straight")
170195
public void minimumIs1MaximumIs5ButNotALittleStraight() {
171196
Yacht yacht = new Yacht(new int[]{ 1, 1, 3, 4, 5 }, YachtCategory.LITTLE_STRAIGHT);
172197
assertThat(yacht.score()).isEqualTo(0);
173198
}
174199

175200
@Disabled("Remove to run test")
176201
@Test
202+
@DisplayName("Big Straight")
177203
public void bigStraight() {
178204
Yacht yacht = new Yacht(new int[]{ 4, 6, 2, 5, 3 }, YachtCategory.BIG_STRAIGHT);
179205
assertThat(yacht.score()).isEqualTo(30);
180206
}
181207

182208
@Disabled("Remove to run test")
183209
@Test
210+
@DisplayName("Big Straight as little straight")
184211
public void bigStraightAsLittleStraight() {
185212
Yacht yacht = new Yacht(new int[]{ 6, 5, 4, 3, 2 }, YachtCategory.LITTLE_STRAIGHT);
186213
assertThat(yacht.score()).isEqualTo(0);
187214
}
188-
215+
189216
@Disabled("Remove to run test")
190217
@Test
218+
@DisplayName("No pairs but not a big straight")
191219
public void noPairsButNotABigStraight() {
192220
Yacht yacht = new Yacht(new int[]{ 6, 5, 4, 3, 1 }, YachtCategory.BIG_STRAIGHT);
193221
assertThat(yacht.score()).isEqualTo(0);
194222
}
195223

196224
@Disabled("Remove to run test")
197225
@Test
226+
@DisplayName("Choice")
198227
public void choice() {
199228
Yacht yacht = new Yacht(new int[]{ 3, 3, 5, 6, 6 }, YachtCategory.CHOICE);
200229
assertThat(yacht.score()).isEqualTo(23);
201230
}
202231

203232
@Disabled("Remove to run test")
204233
@Test
234+
@DisplayName("Yacht as choice")
205235
public void yachtAsChoice() {
206236
Yacht yacht = new Yacht(new int[]{ 2, 2, 2, 2, 2 }, YachtCategory.CHOICE);
207237
assertThat(yacht.score()).isEqualTo(10);

exercises/practice/zebra-puzzle/src/test/java/ZebraPuzzleTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22
import org.junit.jupiter.api.Test;
33

44
import static org.assertj.core.api.Assertions.assertThat;
5+
import org.junit.jupiter.api.DisplayName;
56

67
public class ZebraPuzzleTest {
78

89
@Test
10+
@DisplayName("resident who drinks water")
911
public void residentWhoDrinksWater() {
1012
ZebraPuzzle zebraPuzzle = new ZebraPuzzle();
1113
assertThat(zebraPuzzle.getWaterDrinker()).isEqualTo("Norwegian");
1214
}
1315

1416
@Disabled("Remove to run test")
1517
@Test
18+
@DisplayName("resident who owns zebra")
1619
public void residentWhoOwnsZebra() {
1720
ZebraPuzzle zebraPuzzle = new ZebraPuzzle();
1821
assertThat(zebraPuzzle.getZebraOwner()).isEqualTo("Japanese");

0 commit comments

Comments
 (0)