|
@@ -3,11 +3,7 @@ package io.zipcoder.casino;
|
3
|
3
|
import org.junit.Assert;
|
4
|
4
|
import org.junit.Before;
|
5
|
5
|
import org.junit.Test;
|
6
|
|
-
|
7
|
|
-import java.io.ByteArrayInputStream;
|
8
|
6
|
import java.util.ArrayList;
|
9
|
|
-import java.util.NoSuchElementException;
|
10
|
|
-import java.util.Scanner;
|
11
|
7
|
|
12
|
8
|
public class StudTest {
|
13
|
9
|
|
|
@@ -243,6 +239,8 @@ public class StudTest {
|
243
|
239
|
Assert.assertEquals(expected, actual);
|
244
|
240
|
}
|
245
|
241
|
|
|
242
|
+<<<<<<< HEAD
|
|
243
|
+=======
|
246
|
244
|
@Test //Either payAnte or Test is broken, Ante is not deducted. Test set to pass
|
247
|
245
|
public void payAnteTest(){
|
248
|
246
|
stud.payAnte(stud.getPlayers());
|
|
@@ -251,6 +249,7 @@ public class StudTest {
|
251
|
249
|
Assert.assertEquals(expect, actual);
|
252
|
250
|
}
|
253
|
251
|
|
|
252
|
+>>>>>>> abcff63819ca0f646e4e501b1afae90ab549a292
|
254
|
253
|
@Test
|
255
|
254
|
public void playCardTest(){
|
256
|
255
|
stud.playCard(cardPlayer1.getPlayer(), cardPlayer1.getHand().get(0));
|
|
@@ -272,6 +271,8 @@ public class StudTest {
|
272
|
271
|
|
273
|
272
|
Assert.assertEquals(expected, actual);
|
274
|
273
|
}
|
|
274
|
+<<<<<<< HEAD
|
|
275
|
+=======
|
275
|
276
|
|
276
|
277
|
@Test
|
277
|
278
|
public void testStartRound(){
|
|
@@ -292,83 +293,38 @@ public class StudTest {
|
292
|
293
|
}
|
293
|
294
|
/*
|
294
|
295
|
CODE FOR TRASH PANDAS
|
|
296
|
+>>>>>>> abcff63819ca0f646e4e501b1afae90ab549a292
|
295
|
297
|
|
296
|
298
|
@Test
|
297
|
|
- public void flipCardTest(){
|
298
|
|
- stud.deal();
|
|
299
|
+ public void tableTest(){
|
|
300
|
+ stud.changeTablePot(10);
|
299
|
301
|
//WHEN @Before
|
300
|
|
- boolean expected = false;
|
|
302
|
+ int expected = 10;
|
301
|
303
|
//THEN
|
302
|
|
- boolean actual = stud.flipCard();
|
|
304
|
+ int actual = stud.getTablePot();
|
303
|
305
|
|
304
|
306
|
Assert.assertEquals(expected, actual);
|
305
|
307
|
}
|
306
|
308
|
|
307
|
|
- public CardPlayer determineWinner(ArrayList<CardPlayer> players){
|
308
|
|
- int max = 0;
|
309
|
|
- CardPlayer winner = null;
|
310
|
|
-
|
311
|
|
- for(int i = 0; i < players.size(); i ++){
|
312
|
|
- CardPlayer player = players.get(i);
|
313
|
|
- int playerHandValue = handValue(player); // 'handValue' method sets 'max' value of this hand
|
314
|
|
- if(playerHandValue > max){
|
315
|
|
- max = playerHandValue;
|
316
|
|
- winner = player;
|
317
|
|
- }
|
318
|
|
- }
|
319
|
|
- System.out.println("The winner is " + winner.getPlayer().getName());
|
320
|
|
- System.out.println(winner.getPlayer().getName() + "\'s hand was: " + winner.getHand().get(0).getName() +
|
321
|
|
- " - " + winner.getHand().get(1).getName() + " - " + winner.getHand().get(2).getName() + "\n\n" );
|
322
|
|
- return winner;
|
323
|
|
- }
|
324
|
|
-
|
325
|
|
- public CardPlayer determineWinner(){
|
326
|
|
- int max = 0;
|
327
|
|
- CardPlayer winner = null;
|
328
|
|
-
|
329
|
|
- for(int i = 0; i < getPlayers().size(); i ++){
|
330
|
|
- CardPlayer player = getPlayers().get(i);
|
331
|
|
- int playerHandValue = handValue(player); // 'handValue' method sets 'max' value of this hand
|
332
|
|
- if(playerHandValue > max){
|
333
|
|
- max = playerHandValue;
|
334
|
|
- winner = player;
|
335
|
|
- }
|
336
|
|
- }
|
337
|
|
- System.out.println("The winner is " + winner.getPlayer().getName());
|
338
|
|
- System.out.println(winner.getPlayer().getName() + "\'s hand was: " + winner.getHand().get(0).getName() +
|
339
|
|
- " - " + winner.getHand().get(1).getName() + " - " + winner.getHand().get(2).getName() + "\n\n" );
|
340
|
|
- return winner;
|
341
|
|
- }
|
342
|
|
-
|
343
|
|
- public void startRound() {
|
344
|
|
- System.out.println("Welcome to Three Card Stud! Cards are dealt!");
|
345
|
|
- flipCard();
|
346
|
|
- gameRound();
|
347
|
|
- flipCard();
|
348
|
|
- gameRound2();
|
349
|
|
- flipCard();
|
350
|
|
- lastGameRound();
|
351
|
|
- determineWinner(this.getPlayers()); //TEST ADDED ARGUMENT
|
352
|
|
- }
|
|
309
|
+ @Test
|
|
310
|
+ public void setHandSizeTest(){
|
|
311
|
+ stud.setHandSize(5);
|
|
312
|
+ //WHEN @Before
|
|
313
|
+ int expected = 5;
|
|
314
|
+ //THEN
|
|
315
|
+ int actual = stud.getHandSize();
|
353
|
316
|
|
354
|
|
- /*
|
355
|
|
- public void payAnte() {
|
356
|
|
- for(int i = 0; i < super.getPlayers().size(); i ++)
|
357
|
|
- {
|
358
|
|
- CardPlayer player = super.getPlayers().get(i);
|
359
|
|
- player.getPlayer().changeBalance(-super.getAnte());
|
360
|
|
- }
|
|
317
|
+ Assert.assertEquals(expected, actual);
|
361
|
318
|
}
|
362
|
319
|
|
363
|
|
- * PreCondition: Betting rounds already played
|
364
|
|
- * Plays through round that include flipping last card face up
|
365
|
|
- * PostCondtion: tablePot is now at max value
|
366
|
|
- * DetermineWinner() expected to be called after this method
|
|
320
|
+ @Test
|
|
321
|
+ public void setPlayersTurnTest(){
|
|
322
|
+ stud.setPlayersTurn(cardPlayer1);
|
|
323
|
+ //WHEN @Before
|
|
324
|
+ CardPlayer expected = cardPlayer1;
|
|
325
|
+ //THEN
|
|
326
|
+ CardPlayer actual = stud.getPlayersTurn();
|
367
|
327
|
|
368
|
|
-public void lastGameRound(){
|
369
|
|
- for (int j = 0; j < getPlayers().size(); j++) {
|
370
|
|
- CardPlayer player = super.getPlayers().get(j); //GET a player
|
371
|
|
- playCard(player.getPlayer(), player.getHand().get(2)); //SHOW-PRINT players first CARD
|
|
328
|
+ Assert.assertEquals(expected, actual);
|
372
|
329
|
}
|
373
|
330
|
}
|
374
|
|
-*/
|