|
@@ -50,7 +50,7 @@ public class YahtzeeTest {
|
50
|
50
|
//When
|
51
|
51
|
yahtzee.startGame();
|
52
|
52
|
String expected = yahtzee.getDicePlayer().cupToString();
|
53
|
|
- yahtzee.rollOptions(3);
|
|
53
|
+ yahtzee.rollOptions(3, "");
|
54
|
54
|
String actual = yahtzee.getDicePlayer().cupToString();
|
55
|
55
|
|
56
|
56
|
//Then
|
|
@@ -64,7 +64,7 @@ public class YahtzeeTest {
|
64
|
64
|
//When
|
65
|
65
|
yahtzee.startGame();
|
66
|
66
|
String expected = yahtzee.getDicePlayer().cupToString();
|
67
|
|
- yahtzee.rollOptions(1);
|
|
67
|
+ yahtzee.rollOptions(1, "");
|
68
|
68
|
String actual = yahtzee.getDicePlayer().cupToString();
|
69
|
69
|
|
70
|
70
|
//Then
|
|
@@ -79,7 +79,7 @@ public class YahtzeeTest {
|
79
|
79
|
yahtzee.startGame();
|
80
|
80
|
int diceOneValue = yahtzee.getDicePlayer().getCup()[0].getValue();
|
81
|
81
|
int diceTwoValue = yahtzee.getDicePlayer().getCup()[1].getValue();
|
82
|
|
- yahtzee.reRoll(Integer.toString(diceTwoValue));
|
|
82
|
+ yahtzee.rollOptions(2, Integer.toString(diceTwoValue));
|
83
|
83
|
int actual = yahtzee.getDicePlayer().getCup()[0].getValue();
|
84
|
84
|
|
85
|
85
|
//Then
|
|
@@ -112,5 +112,159 @@ public class YahtzeeTest {
|
112
|
112
|
|
113
|
113
|
}
|
114
|
114
|
|
|
115
|
+ @Test
|
|
116
|
+ public void testPayout() {
|
|
117
|
+ //When
|
|
118
|
+ int expected = yahtzee.getDicePlayer().getPlayer().getCurrentBalance();
|
|
119
|
+ yahtzee.payout();
|
|
120
|
+ int actual = yahtzee.getDicePlayer().getPlayer().getCurrentBalance();
|
|
121
|
+
|
|
122
|
+ //Then
|
|
123
|
+ Assert.assertEquals(expected, actual);
|
|
124
|
+
|
|
125
|
+ }
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+ @Test
|
|
129
|
+ public void testSelectingRow1() {
|
|
130
|
+ //When
|
|
131
|
+ ScoreSheet.ROW expected = ScoreSheet.ROW.ACES;
|
|
132
|
+ ScoreSheet.ROW actual = yahtzee.selectingRow(1);
|
|
133
|
+
|
|
134
|
+ //Then
|
|
135
|
+ Assert.assertEquals(expected, actual);
|
|
136
|
+
|
|
137
|
+ }
|
|
138
|
+
|
|
139
|
+ @Test
|
|
140
|
+ public void testSelectingRow2() {
|
|
141
|
+ //When
|
|
142
|
+ ScoreSheet.ROW expected = ScoreSheet.ROW.TWOS;
|
|
143
|
+ ScoreSheet.ROW actual = yahtzee.selectingRow(2);
|
|
144
|
+
|
|
145
|
+ //Then
|
|
146
|
+ Assert.assertEquals(expected, actual);
|
|
147
|
+
|
|
148
|
+ }
|
|
149
|
+
|
|
150
|
+ @Test
|
|
151
|
+ public void testSelectingRow3() {
|
|
152
|
+ //When
|
|
153
|
+ ScoreSheet.ROW expected = ScoreSheet.ROW.THREES;
|
|
154
|
+ ScoreSheet.ROW actual = yahtzee.selectingRow(3);
|
|
155
|
+
|
|
156
|
+ //Then
|
|
157
|
+ Assert.assertEquals(expected, actual);
|
|
158
|
+
|
|
159
|
+ }
|
|
160
|
+
|
|
161
|
+ @Test
|
|
162
|
+ public void testSelectingRow4() {
|
|
163
|
+ //When
|
|
164
|
+ ScoreSheet.ROW expected = ScoreSheet.ROW.FOURS;
|
|
165
|
+ ScoreSheet.ROW actual = yahtzee.selectingRow(4);
|
|
166
|
+
|
|
167
|
+ //Then
|
|
168
|
+ Assert.assertEquals(expected, actual);
|
|
169
|
+
|
|
170
|
+ }
|
|
171
|
+
|
|
172
|
+ @Test
|
|
173
|
+ public void testSelectingRow5() {
|
|
174
|
+ //When
|
|
175
|
+ ScoreSheet.ROW expected = ScoreSheet.ROW.FIVES;
|
|
176
|
+ ScoreSheet.ROW actual = yahtzee.selectingRow(5);
|
|
177
|
+
|
|
178
|
+ //Then
|
|
179
|
+ Assert.assertEquals(expected, actual);
|
|
180
|
+
|
|
181
|
+ }
|
|
182
|
+
|
|
183
|
+ @Test
|
|
184
|
+ public void testSelectingRow6() {
|
|
185
|
+ //When
|
|
186
|
+ ScoreSheet.ROW expected = ScoreSheet.ROW.SIXES;
|
|
187
|
+ ScoreSheet.ROW actual = yahtzee.selectingRow(6);
|
|
188
|
+
|
|
189
|
+ //Then
|
|
190
|
+ Assert.assertEquals(expected, actual);
|
|
191
|
+
|
|
192
|
+ }
|
115
|
193
|
|
|
194
|
+ @Test
|
|
195
|
+ public void testSelectingRow7() {
|
|
196
|
+ //When
|
|
197
|
+ ScoreSheet.ROW expected = ScoreSheet.ROW.THREEOFAKIND;
|
|
198
|
+ ScoreSheet.ROW actual = yahtzee.selectingRow(7);
|
|
199
|
+
|
|
200
|
+ //Then
|
|
201
|
+ Assert.assertEquals(expected, actual);
|
|
202
|
+
|
|
203
|
+ }
|
|
204
|
+
|
|
205
|
+ @Test
|
|
206
|
+ public void testSelectingRow8() {
|
|
207
|
+ //When
|
|
208
|
+ ScoreSheet.ROW expected = ScoreSheet.ROW.FOUROFAKIND;
|
|
209
|
+ ScoreSheet.ROW actual = yahtzee.selectingRow(8);
|
|
210
|
+
|
|
211
|
+ //Then
|
|
212
|
+ Assert.assertEquals(expected, actual);
|
|
213
|
+
|
|
214
|
+ }
|
|
215
|
+
|
|
216
|
+ @Test
|
|
217
|
+ public void testSelectingRow9() {
|
|
218
|
+ //When
|
|
219
|
+ ScoreSheet.ROW expected = ScoreSheet.ROW.FULLHOUSE;
|
|
220
|
+ ScoreSheet.ROW actual = yahtzee.selectingRow(9);
|
|
221
|
+
|
|
222
|
+ //Then
|
|
223
|
+ Assert.assertEquals(expected, actual);
|
|
224
|
+
|
|
225
|
+ }
|
|
226
|
+
|
|
227
|
+ @Test
|
|
228
|
+ public void testSelectingRow10() {
|
|
229
|
+ //When
|
|
230
|
+ ScoreSheet.ROW expected = ScoreSheet.ROW.SMALLSTRAIGHT;
|
|
231
|
+ ScoreSheet.ROW actual = yahtzee.selectingRow(10);
|
|
232
|
+
|
|
233
|
+ //Then
|
|
234
|
+ Assert.assertEquals(expected, actual);
|
|
235
|
+
|
|
236
|
+ }
|
|
237
|
+
|
|
238
|
+ @Test
|
|
239
|
+ public void testSelectingRow11() {
|
|
240
|
+ //When
|
|
241
|
+ ScoreSheet.ROW expected = ScoreSheet.ROW.LARGESTRAIGHT;
|
|
242
|
+ ScoreSheet.ROW actual = yahtzee.selectingRow(11);
|
|
243
|
+
|
|
244
|
+ //Then
|
|
245
|
+ Assert.assertEquals(expected, actual);
|
|
246
|
+
|
|
247
|
+ }
|
|
248
|
+
|
|
249
|
+ @Test
|
|
250
|
+ public void testSelectingRow12() {
|
|
251
|
+ //When
|
|
252
|
+ ScoreSheet.ROW expected = ScoreSheet.ROW.YAHTZEE;
|
|
253
|
+ ScoreSheet.ROW actual = yahtzee.selectingRow(12);
|
|
254
|
+
|
|
255
|
+ //Then
|
|
256
|
+ Assert.assertEquals(expected, actual);
|
|
257
|
+
|
|
258
|
+ }
|
|
259
|
+
|
|
260
|
+ @Test
|
|
261
|
+ public void testSelectingRow13() {
|
|
262
|
+ //When
|
|
263
|
+ ScoreSheet.ROW expected = ScoreSheet.ROW.CHANCE;
|
|
264
|
+ ScoreSheet.ROW actual = yahtzee.selectingRow(13);
|
|
265
|
+
|
|
266
|
+ //Then
|
|
267
|
+ Assert.assertEquals(expected, actual);
|
|
268
|
+
|
|
269
|
+ }
|
116
|
270
|
}
|