Jonathan Hinds 6 år sedan
förälder
incheckning
303a2693e7

+ 2
- 2
src/main/java/io/zipcoder/casino/Casino.java Visa fil

@@ -135,8 +135,8 @@ public class Casino {
135 135
         return game;
136 136
     }
137 137
 
138
-    public void setGame(Game game) {
139
-        this.game = game;
138
+    public Game[] getCardGames() {
139
+        return cardGames;
140 140
     }
141 141
 
142 142
 }

+ 7
- 0
src/test/java/io/zipcoder/casino/CasinoTest.java Visa fil

@@ -63,15 +63,22 @@ public class CasinoTest {
63 63
 
64 64
         Casino casino = new Casino();
65 65
         casino.setPlayer(new Player("Lauren", 1000));
66
+        Game studGame = casino.getCardGames()[0];
66 67
 
67 68
         String input = "3 \n 2 \n Nick \n 1000 \n";
69
+        String studInput = "flip \n flip \n flip";
68 70
 
69 71
 
70 72
         casino.getConsole().setScanner(new Scanner(new ByteArrayInputStream(input.getBytes())));
73
+        ((Stud)studGame).setScanner(new Scanner(new ByteArrayInputStream(studInput.getBytes())));
71 74
         try {
72 75
             casino.chooseGame();
73 76
         }catch(NoSuchElementException e){
74 77
 
75 78
         }
79
+
80
+        Game game = casino.getGame();
81
+
82
+        Assert.assertEquals(2, ((Stud)game).getPlayers().size());
76 83
     }
77 84
 }

+ 2
- 2
src/test/java/io/zipcoder/casino/SlotTest.java Visa fil

@@ -10,9 +10,9 @@ import java.util.Random;
10 10
 
11 11
 public class SlotTest {
12 12
     private int betAmount = 10;
13
-    private SlotMachine slotmachine = new SlotMachine(betAmount);
14 13
 
15 14
     Player player = new Player("Bob", 400);
15
+    private SlotMachine slotmachine = new SlotMachine(betAmount, player);
16 16
 
17 17
     @Test
18 18
     public void testSlotResult1(){
@@ -122,7 +122,7 @@ public class SlotTest {
122 122
     @Test
123 123
     public void testSetBetAmount(){
124 124
         int betAmount=10;
125
-        SlotMachine slotmachine = new SlotMachine(betAmount);
125
+        SlotMachine slotmachine = new SlotMachine(betAmount, player);
126 126
 
127 127
         int newBet = 40;
128 128
 

+ 1
- 5
src/test/java/io/zipcoder/casino/StudTest.java Visa fil

@@ -239,8 +239,6 @@ public class StudTest {
239 239
         Assert.assertEquals(expected, actual);
240 240
     }
241 241
 
242
-<<<<<<< HEAD
243
-=======
244 242
     @Test //Either payAnte or Test is broken, Ante is not deducted. Test set to pass
245 243
     public void payAnteTest(){
246 244
        stud.payAnte(stud.getPlayers());
@@ -249,7 +247,6 @@ public class StudTest {
249 247
        Assert.assertEquals(expect, actual);
250 248
     }
251 249
 
252
->>>>>>> abcff63819ca0f646e4e501b1afae90ab549a292
253 250
     @Test
254 251
     public void playCardTest(){
255 252
         stud.playCard(cardPlayer1.getPlayer(), cardPlayer1.getHand().get(0));
@@ -271,8 +268,6 @@ public class StudTest {
271 268
 
272 269
         Assert.assertEquals(expected, actual);
273 270
     }
274
-<<<<<<< HEAD
275
-=======
276 271
 
277 272
     @Test
278 273
     public void testStartRound(){
@@ -328,3 +323,4 @@ public class StudTest {
328 323
         Assert.assertEquals(expected, actual);
329 324
     }
330 325
 }
326
+*/