|
1 | 1 | import org.junit.jupiter.api.Disabled; |
2 | 2 | import org.junit.jupiter.api.Test; |
| 3 | +import org.junit.jupiter.api.DisplayName; |
3 | 4 |
|
4 | 5 | import static org.assertj.core.api.Assertions.assertThat; |
5 | 6 |
|
6 | 7 | public class YachtTest { |
7 | 8 |
|
8 | 9 | @Test |
| 10 | + @DisplayName("Yacht") |
9 | 11 | public void yacht() { |
10 | 12 | Yacht yacht = new Yacht(new int[]{ 5, 5, 5, 5, 5 }, YachtCategory.YACHT); |
11 | 13 | assertThat(yacht.score()).isEqualTo(50); |
12 | 14 | } |
13 | 15 |
|
14 | 16 | @Disabled("Remove to run test") |
15 | 17 | @Test |
| 18 | + @DisplayName("Not Yacht") |
16 | 19 | public void notYacht() { |
17 | 20 | Yacht yacht = new Yacht(new int[]{ 1, 3, 3, 2, 5 }, YachtCategory.YACHT); |
18 | 21 | assertThat(yacht.score()).isEqualTo(0); |
19 | 22 | } |
20 | 23 |
|
21 | 24 | @Disabled("Remove to run test") |
22 | 25 | @Test |
| 26 | + @DisplayName("Ones") |
23 | 27 | public void ones() { |
24 | 28 | Yacht yacht = new Yacht(new int[]{ 1, 1, 1, 3, 5 }, YachtCategory.ONES); |
25 | 29 | assertThat(yacht.score()).isEqualTo(3); |
26 | 30 | } |
27 | 31 |
|
28 | 32 | @Disabled("Remove to run test") |
29 | 33 | @Test |
| 34 | + @DisplayName("Ones, out of order") |
30 | 35 | public void onesOutOfOrder() { |
31 | 36 | Yacht yacht = new Yacht(new int[]{ 3, 1, 1, 5, 1 }, YachtCategory.ONES); |
32 | 37 | assertThat(yacht.score()).isEqualTo(3); |
33 | 38 | } |
34 | 39 |
|
35 | 40 | @Disabled("Remove to run test") |
36 | 41 | @Test |
| 42 | + @DisplayName("No ones") |
37 | 43 | public void noOnes() { |
38 | 44 | Yacht yacht = new Yacht(new int[]{ 4, 3, 6, 5, 5 }, YachtCategory.ONES); |
39 | 45 | assertThat(yacht.score()).isEqualTo(0); |
40 | 46 | } |
41 | 47 |
|
42 | 48 | @Disabled("Remove to run test") |
43 | 49 | @Test |
| 50 | + @DisplayName("Twos") |
44 | 51 | public void twos() { |
45 | 52 | Yacht yacht = new Yacht(new int[]{ 2, 3, 4, 5, 6 }, YachtCategory.TWOS); |
46 | 53 | assertThat(yacht.score()).isEqualTo(2); |
47 | 54 | } |
48 | 55 |
|
49 | 56 | @Disabled("Remove to run test") |
50 | 57 | @Test |
| 58 | + @DisplayName("Fours") |
51 | 59 | public void fours() { |
52 | 60 | Yacht yacht = new Yacht(new int[]{ 1, 4, 1, 4, 1 }, YachtCategory.FOURS); |
53 | 61 | assertThat(yacht.score()).isEqualTo(8); |
54 | 62 | } |
55 | 63 |
|
56 | 64 | @Disabled("Remove to run test") |
57 | 65 | @Test |
| 66 | + @DisplayName("Yacht of 3s counted as fives") |
58 | 67 | public void yachtCountedAsThrees() { |
59 | 68 | Yacht yacht = new Yacht(new int[]{ 3, 3, 3, 3, 3 }, YachtCategory.THREES); |
60 | 69 | assertThat(yacht.score()).isEqualTo(15); |
61 | 70 | } |
62 | 71 |
|
63 | 72 | @Disabled("Remove to run test") |
64 | 73 | @Test |
| 74 | + @DisplayName("Yacht of 3s counted as fives") |
65 | 75 | public void yachtOfThreesCountedAsFives() { |
66 | 76 | Yacht yacht = new Yacht(new int[]{ 3, 3, 3, 3, 3 }, YachtCategory.FIVES); |
67 | 77 | assertThat(yacht.score()).isEqualTo(0); |
68 | 78 | } |
69 | | - |
| 79 | + |
70 | 80 | @Disabled("Remove to run test") |
71 | 81 | @Test |
| 82 | + @DisplayName("Fives") |
72 | 83 | public void fives() { |
73 | 84 | Yacht yacht = new Yacht(new int[]{ 1, 5, 3, 5, 3 }, YachtCategory.FIVES); |
74 | 85 | assertThat(yacht.score()).isEqualTo(10); |
75 | 86 | } |
76 | 87 |
|
77 | 88 | @Disabled("Remove to run test") |
78 | 89 | @Test |
| 90 | + @DisplayName("Sixes") |
79 | 91 | public void sixes() { |
80 | 92 | Yacht yacht = new Yacht(new int[]{ 2, 3, 4, 5, 6 }, YachtCategory.SIXES); |
81 | 93 | assertThat(yacht.score()).isEqualTo(6); |
82 | 94 | } |
83 | 95 |
|
84 | 96 | @Disabled("Remove to run test") |
85 | 97 | @Test |
| 98 | + @DisplayName("Full house two small, three big") |
86 | 99 | public void fullHouseTwoSmallThreeBig() { |
87 | 100 | Yacht yacht = new Yacht(new int[]{ 2, 2, 4, 4, 4 }, YachtCategory.FULL_HOUSE); |
88 | 101 | assertThat(yacht.score()).isEqualTo(16); |
89 | 102 | } |
90 | 103 |
|
91 | 104 | @Disabled("Remove to run test") |
92 | 105 | @Test |
| 106 | + @DisplayName("Full house three small, two big") |
93 | 107 | public void fullHouseThreeSmallTwoBig() { |
94 | 108 | Yacht yacht = new Yacht(new int[]{ 5, 3, 3, 5, 3 }, YachtCategory.FULL_HOUSE); |
95 | 109 | assertThat(yacht.score()).isEqualTo(19); |
96 | 110 | } |
97 | 111 |
|
98 | 112 | @Disabled("Remove to run test") |
99 | 113 | @Test |
| 114 | + @DisplayName("Two pair is not a full house") |
100 | 115 | public void twoPairIsNotAFullHouse() { |
101 | 116 | Yacht yacht = new Yacht(new int[]{ 2, 2, 4, 4, 5 }, YachtCategory.FULL_HOUSE); |
102 | 117 | assertThat(yacht.score()).isEqualTo(0); |
103 | 118 | } |
104 | 119 |
|
105 | 120 | @Disabled("Remove to run test") |
106 | 121 | @Test |
| 122 | + @DisplayName("Four of a kind is not a full house") |
107 | 123 | public void fourOfAKindIsNotAFullHouse() { |
108 | 124 | Yacht yacht = new Yacht(new int[]{ 1, 4, 4, 4, 4 }, YachtCategory.FULL_HOUSE); |
109 | 125 | assertThat(yacht.score()).isEqualTo(0); |
110 | 126 | } |
111 | 127 |
|
112 | 128 | @Disabled("Remove to run test") |
113 | 129 | @Test |
| 130 | + @DisplayName("Yacht is not a full house") |
114 | 131 | public void yachtIsNotAFullHouse() { |
115 | 132 | Yacht yacht = new Yacht(new int[]{ 2, 2, 2, 2, 2 }, YachtCategory.FULL_HOUSE); |
116 | 133 | assertThat(yacht.score()).isEqualTo(0); |
117 | 134 | } |
118 | 135 |
|
119 | 136 | @Disabled("Remove to run test") |
120 | 137 | @Test |
| 138 | + @DisplayName("Four of a Kind") |
121 | 139 | public void fourOfAKind() { |
122 | 140 | Yacht yacht = new Yacht(new int[]{ 6, 6, 4, 6, 6 }, YachtCategory.FOUR_OF_A_KIND); |
123 | 141 | assertThat(yacht.score()).isEqualTo(24); |
124 | 142 | } |
125 | 143 |
|
126 | 144 | @Disabled("Remove to run test") |
127 | 145 | @Test |
| 146 | + @DisplayName("Yacht can be scored as Four of a Kind") |
128 | 147 | public void yachtCanBeScoredAsFourOfAKind() { |
129 | 148 | Yacht yacht = new Yacht(new int[]{ 3, 3, 3, 3, 3 }, YachtCategory.FOUR_OF_A_KIND); |
130 | 149 | assertThat(yacht.score()).isEqualTo(12); |
131 | 150 | } |
132 | 151 |
|
133 | 152 | @Disabled("Remove to run test") |
134 | 153 | @Test |
| 154 | + @DisplayName("Full house is not Four of a Kind") |
135 | 155 | public void fullHouseIsNotFourOfAKind() { |
136 | 156 | Yacht yacht = new Yacht(new int[]{ 3, 3, 3, 5, 5 }, YachtCategory.FOUR_OF_A_KIND); |
137 | 157 | assertThat(yacht.score()).isEqualTo(0); |
138 | 158 | } |
139 | 159 |
|
140 | 160 | @Disabled("Remove to run test") |
141 | 161 | @Test |
| 162 | + @DisplayName("Little Straight") |
142 | 163 | public void littleStraight() { |
143 | 164 | Yacht yacht = new Yacht(new int[]{ 3, 5, 4, 1, 2 }, YachtCategory.LITTLE_STRAIGHT); |
144 | 165 | assertThat(yacht.score()).isEqualTo(30); |
145 | 166 | } |
146 | 167 |
|
147 | 168 | @Disabled("Remove to run test") |
148 | 169 | @Test |
| 170 | + @DisplayName("Little Straight as Big Straight") |
149 | 171 | public void littleStraightAsBigStraight() { |
150 | 172 | Yacht yacht = new Yacht(new int[]{ 1, 2, 3, 4, 5 }, YachtCategory.BIG_STRAIGHT); |
151 | 173 | assertThat(yacht.score()).isEqualTo(0); |
152 | 174 | } |
153 | 175 |
|
154 | 176 | @Disabled("Remove to run test") |
155 | 177 | @Test |
| 178 | + @DisplayName("Four in order but not a little straight") |
156 | 179 | public void fourInOrderButNotALittleStraight() { |
157 | 180 | Yacht yacht = new Yacht(new int[]{ 1, 1, 2, 3, 4 }, YachtCategory.LITTLE_STRAIGHT); |
158 | 181 | assertThat(yacht.score()).isEqualTo(0); |
159 | 182 | } |
160 | 183 |
|
161 | 184 | @Disabled("Remove to run test") |
162 | 185 | @Test |
| 186 | + @DisplayName("No pairs but not a little straight") |
163 | 187 | public void noPairsButNotALittleStraight() { |
164 | 188 | Yacht yacht = new Yacht(new int[]{ 1, 2, 3, 4, 6 }, YachtCategory.LITTLE_STRAIGHT); |
165 | 189 | assertThat(yacht.score()).isEqualTo(0); |
166 | 190 | } |
167 | 191 |
|
168 | 192 | @Disabled("Remove to run test") |
169 | 193 | @Test |
| 194 | + @DisplayName("Minimum is 1, maximum is 5, but not a little straight") |
170 | 195 | public void minimumIs1MaximumIs5ButNotALittleStraight() { |
171 | 196 | Yacht yacht = new Yacht(new int[]{ 1, 1, 3, 4, 5 }, YachtCategory.LITTLE_STRAIGHT); |
172 | 197 | assertThat(yacht.score()).isEqualTo(0); |
173 | 198 | } |
174 | 199 |
|
175 | 200 | @Disabled("Remove to run test") |
176 | 201 | @Test |
| 202 | + @DisplayName("Big Straight") |
177 | 203 | public void bigStraight() { |
178 | 204 | Yacht yacht = new Yacht(new int[]{ 4, 6, 2, 5, 3 }, YachtCategory.BIG_STRAIGHT); |
179 | 205 | assertThat(yacht.score()).isEqualTo(30); |
180 | 206 | } |
181 | 207 |
|
182 | 208 | @Disabled("Remove to run test") |
183 | 209 | @Test |
| 210 | + @DisplayName("Big Straight as little straight") |
184 | 211 | public void bigStraightAsLittleStraight() { |
185 | 212 | Yacht yacht = new Yacht(new int[]{ 6, 5, 4, 3, 2 }, YachtCategory.LITTLE_STRAIGHT); |
186 | 213 | assertThat(yacht.score()).isEqualTo(0); |
187 | 214 | } |
188 | | - |
| 215 | + |
189 | 216 | @Disabled("Remove to run test") |
190 | 217 | @Test |
| 218 | + @DisplayName("No pairs but not a big straight") |
191 | 219 | public void noPairsButNotABigStraight() { |
192 | 220 | Yacht yacht = new Yacht(new int[]{ 6, 5, 4, 3, 1 }, YachtCategory.BIG_STRAIGHT); |
193 | 221 | assertThat(yacht.score()).isEqualTo(0); |
194 | 222 | } |
195 | 223 |
|
196 | 224 | @Disabled("Remove to run test") |
197 | 225 | @Test |
| 226 | + @DisplayName("Choice") |
198 | 227 | public void choice() { |
199 | 228 | Yacht yacht = new Yacht(new int[]{ 3, 3, 5, 6, 6 }, YachtCategory.CHOICE); |
200 | 229 | assertThat(yacht.score()).isEqualTo(23); |
201 | 230 | } |
202 | 231 |
|
203 | 232 | @Disabled("Remove to run test") |
204 | 233 | @Test |
| 234 | + @DisplayName("Yacht as choice") |
205 | 235 | public void yachtAsChoice() { |
206 | 236 | Yacht yacht = new Yacht(new int[]{ 2, 2, 2, 2, 2 }, YachtCategory.CHOICE); |
207 | 237 | assertThat(yacht.score()).isEqualTo(10); |
|
0 commit comments