Browse Source

tested stud

Jonathan Hinds 6 years ago
parent
commit
303a2693e7

+ 2
- 2
src/main/java/io/zipcoder/casino/Casino.java View File

135
         return game;
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 View File

63
 
63
 
64
         Casino casino = new Casino();
64
         Casino casino = new Casino();
65
         casino.setPlayer(new Player("Lauren", 1000));
65
         casino.setPlayer(new Player("Lauren", 1000));
66
+        Game studGame = casino.getCardGames()[0];
66
 
67
 
67
         String input = "3 \n 2 \n Nick \n 1000 \n";
68
         String input = "3 \n 2 \n Nick \n 1000 \n";
69
+        String studInput = "flip \n flip \n flip";
68
 
70
 
69
 
71
 
70
         casino.getConsole().setScanner(new Scanner(new ByteArrayInputStream(input.getBytes())));
72
         casino.getConsole().setScanner(new Scanner(new ByteArrayInputStream(input.getBytes())));
73
+        ((Stud)studGame).setScanner(new Scanner(new ByteArrayInputStream(studInput.getBytes())));
71
         try {
74
         try {
72
             casino.chooseGame();
75
             casino.chooseGame();
73
         }catch(NoSuchElementException e){
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 View File

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

+ 1
- 5
src/test/java/io/zipcoder/casino/StudTest.java View File

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