|
@@ -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(){
|
|
@@ -297,83 +298,38 @@ public class StudTest {
|
297
|
298
|
}
|
298
|
299
|
/*
|
299
|
300
|
CODE FOR TRASH PANDAS
|
|
301
|
+>>>>>>> abcff63819ca0f646e4e501b1afae90ab549a292
|
300
|
302
|
|
301
|
303
|
@Test
|
302
|
|
- public void flipCardTest(){
|
303
|
|
- stud.deal();
|
|
304
|
+ public void tableTest(){
|
|
305
|
+ stud.changeTablePot(10);
|
304
|
306
|
//WHEN @Before
|
305
|
|
- boolean expected = false;
|
|
307
|
+ int expected = 10;
|
306
|
308
|
//THEN
|
307
|
|
- boolean actual = stud.flipCard();
|
|
309
|
+ int actual = stud.getTablePot();
|
308
|
310
|
|
309
|
311
|
Assert.assertEquals(expected, actual);
|
310
|
312
|
}
|
311
|
313
|
|
312
|
|
- public CardPlayer determineWinner(ArrayList<CardPlayer> players){
|
313
|
|
- int max = 0;
|
314
|
|
- CardPlayer winner = null;
|
315
|
|
-
|
316
|
|
- for(int i = 0; i < players.size(); i ++){
|
317
|
|
- CardPlayer player = players.get(i);
|
318
|
|
- int playerHandValue = handValue(player); // 'handValue' method sets 'max' value of this hand
|
319
|
|
- if(playerHandValue > max){
|
320
|
|
- max = playerHandValue;
|
321
|
|
- winner = player;
|
322
|
|
- }
|
323
|
|
- }
|
324
|
|
- System.out.println("The winner is " + winner.getPlayer().getName());
|
325
|
|
- System.out.println(winner.getPlayer().getName() + "\'s hand was: " + winner.getHand().get(0).getName() +
|
326
|
|
- " - " + winner.getHand().get(1).getName() + " - " + winner.getHand().get(2).getName() + "\n\n" );
|
327
|
|
- return winner;
|
328
|
|
- }
|
329
|
|
-
|
330
|
|
- public CardPlayer determineWinner(){
|
331
|
|
- int max = 0;
|
332
|
|
- CardPlayer winner = null;
|
333
|
|
-
|
334
|
|
- for(int i = 0; i < getPlayers().size(); i ++){
|
335
|
|
- CardPlayer player = getPlayers().get(i);
|
336
|
|
- int playerHandValue = handValue(player); // 'handValue' method sets 'max' value of this hand
|
337
|
|
- if(playerHandValue > max){
|
338
|
|
- max = playerHandValue;
|
339
|
|
- winner = player;
|
340
|
|
- }
|
341
|
|
- }
|
342
|
|
- System.out.println("The winner is " + winner.getPlayer().getName());
|
343
|
|
- System.out.println(winner.getPlayer().getName() + "\'s hand was: " + winner.getHand().get(0).getName() +
|
344
|
|
- " - " + winner.getHand().get(1).getName() + " - " + winner.getHand().get(2).getName() + "\n\n" );
|
345
|
|
- return winner;
|
346
|
|
- }
|
347
|
|
-
|
348
|
|
- public void startRound() {
|
349
|
|
- System.out.println("Welcome to Three Card Stud! Cards are dealt!");
|
350
|
|
- flipCard();
|
351
|
|
- gameRound();
|
352
|
|
- flipCard();
|
353
|
|
- gameRound2();
|
354
|
|
- flipCard();
|
355
|
|
- lastGameRound();
|
356
|
|
- determineWinner(this.getPlayers()); //TEST ADDED ARGUMENT
|
357
|
|
- }
|
|
314
|
+ @Test
|
|
315
|
+ public void setHandSizeTest(){
|
|
316
|
+ stud.setHandSize(5);
|
|
317
|
+ //WHEN @Before
|
|
318
|
+ int expected = 5;
|
|
319
|
+ //THEN
|
|
320
|
+ int actual = stud.getHandSize();
|
358
|
321
|
|
359
|
|
- /*
|
360
|
|
- public void payAnte() {
|
361
|
|
- for(int i = 0; i < super.getPlayers().size(); i ++)
|
362
|
|
- {
|
363
|
|
- CardPlayer player = super.getPlayers().get(i);
|
364
|
|
- player.getPlayer().changeBalance(-super.getAnte());
|
365
|
|
- }
|
|
322
|
+ Assert.assertEquals(expected, actual);
|
366
|
323
|
}
|
367
|
324
|
|
368
|
|
- * PreCondition: Betting rounds already played
|
369
|
|
- * Plays through round that include flipping last card face up
|
370
|
|
- * PostCondtion: tablePot is now at max value
|
371
|
|
- * DetermineWinner() expected to be called after this method
|
|
325
|
+ @Test
|
|
326
|
+ public void setPlayersTurnTest(){
|
|
327
|
+ stud.setPlayersTurn(cardPlayer1);
|
|
328
|
+ //WHEN @Before
|
|
329
|
+ CardPlayer expected = cardPlayer1;
|
|
330
|
+ //THEN
|
|
331
|
+ CardPlayer actual = stud.getPlayersTurn();
|
372
|
332
|
|
373
|
|
-public void lastGameRound(){
|
374
|
|
- for (int j = 0; j < getPlayers().size(); j++) {
|
375
|
|
- CardPlayer player = super.getPlayers().get(j); //GET a player
|
376
|
|
- playCard(player.getPlayer(), player.getHand().get(2)); //SHOW-PRINT players first CARD
|
|
333
|
+ Assert.assertEquals(expected, actual);
|
377
|
334
|
}
|
378
|
335
|
}
|
379
|
|
-*/
|