Akeem Cherry il y a 6 ans
Parent
révision
c2e3878321

+ 0
- 10
src/main/java/io/zipcoder/casino/BlackjackPlayer.java Voir le fichier

@@ -1,10 +0,0 @@
1
-package io.zipcoder.casino;
2
-
3
-public class BlackjackPlayer extends Player{
4
-
5
-
6
-    public BlackjackPlayer(String name, double moneyStartedWith) {
7
-
8
-        super(name, moneyStartedWith);
9
-    }
10
-}

+ 0
- 16
src/main/java/io/zipcoder/casino/Dealer.java Voir le fichier

@@ -1,16 +0,0 @@
1
-package io.zipcoder.casino;
2
-
3
-public class Dealer extends Player {
4
-
5
-    public Dealer(String name, double moneyStartedWith) {
6
-        super(name, moneyStartedWith);
7
-    }
8
-
9
-    public void dealCards(Player player, Card card){
10
-
11
-    }
12
-
13
-    public void takeBet(Player player, double money){
14
-
15
-    }
16
-}

+ 0
- 55
src/main/java/io/zipcoder/casino/Player.java Voir le fichier

@@ -1,55 +0,0 @@
1
-package io.zipcoder.casino;
2
-
3
-public class Player {
4
-
5
-    private String name;
6
-
7
-    private Hand hand;
8
-
9
-    private Wallet wallet;
10
-    private double wager;
11
-
12
-    public Player(String name, double moneyStartedWith) {
13
-
14
-        this.hand = new Hand();
15
-
16
-        this.name = name;
17
-
18
-        this.wallet = new Wallet(moneyStartedWith);
19
-    }
20
-
21
-    public void addCard(Card card) {
22
-
23
-        hand.add(card);
24
-    }
25
-
26
-    public Hand getHand() {
27
-
28
-        return hand;
29
-    }
30
-
31
-    public void setHand(Hand hand) {
32
-
33
-        this.hand = hand;
34
-    }
35
-
36
-    public String getName() {
37
-
38
-        return name;
39
-    }
40
-
41
-    public void setWager(double money) {
42
-        this.wager = money;
43
-        wallet.takeMoney(money);
44
-    }
45
-
46
-    public double getWalletAmount() {
47
-        return wallet.getCurrentAmount();
48
-    }
49
-
50
-    public double getWager() {
51
-
52
-        return wager;
53
-    }
54
-
55
-}

+ 0
- 45
src/test/java/io/zipcoder/casino/BlackjackPlayerTest.java Voir le fichier

@@ -1,45 +0,0 @@
1
-package io.zipcoder.casino;
2
-
3
-import io.zipcoder.casino.BlackjackPlayer;
4
-import org.junit.Assert;
5
-import org.junit.Before;
6
-import org.junit.Test;
7
-
8
-public class BlackjackPlayerTest {
9
-
10
-    BlackjackPlayer blackjackPlayer;
11
-
12
-
13
-    @Before
14
-    public void setup(){
15
-
16
-        blackjackPlayer  = new BlackjackPlayer("Xzavia", 200.00);
17
-
18
-    }
19
-
20
-    @Test
21
-    public void setWagerTest() {
22
-
23
-        //When
24
-        double actual = 100.00;
25
-
26
-        blackjackPlayer.setWager(100.00);
27
-
28
-        double expected = blackjackPlayer.getWager();
29
-
30
-        //Then
31
-        Assert.assertEquals(expected, actual, 0);
32
-    }
33
-
34
-    @Test
35
-    public void getNameTest() {
36
-
37
-        String expected = "Tommy";
38
-
39
-        String actual = blackjackPlayer.getName();
40
-
41
-        Assert.assertEquals(expected, actual);
42
-    }
43
-
44
-
45
-}

+ 0
- 83
src/test/java/io/zipcoder/casino/PlayerTest.java Voir le fichier

@@ -1,83 +0,0 @@
1
-package io.zipcoder.casino;
2
-
3
-import io.zipcoder.casino.*;
4
-import org.junit.Assert;
5
-import org.junit.Before;
6
-import org.junit.Test;
7
-
8
-import java.util.List;
9
-
10
-public class PlayerTest {
11
-
12
-    Player xzavia;
13
-
14
-    @Before
15
-    public void setup(){
16
-
17
-        xzavia = new Player("Xzavia", 10_000.00);
18
-    }
19
-
20
-    @Test
21
-    public void addCardTest() {
22
-
23
-        //Given
24
-
25
-        Card expected = new Card(Suit.SPADE, Rank.Jack);
26
-
27
-        //When
28
-        xzavia.addCard(expected);
29
-        Card actual = xzavia.getHand().getCards().get(0);
30
-
31
-        //Then
32
-        Assert.assertEquals(expected, actual);
33
-    }
34
-
35
-    @Test
36
-
37
-    public void getHandTest() {
38
-
39
-        //Given
40
-        Card expected = new Card(Suit.SPADE, Rank.Jack);
41
-        Hand hand = new Hand();
42
-
43
-        //When
44
-        hand.add(expected);
45
-        List<Card> cards = hand.getCards();
46
-
47
-        //Then
48
-        Assert.assertTrue(cards.contains(expected));
49
-
50
-    }
51
-
52
-    @Test
53
-
54
-    public void setHandTest() {
55
-
56
-        //Given
57
-        Card expected = new Card(Suit.SPADE, Rank.Jack);
58
-
59
-        Hand hand = new Hand();
60
-
61
-        //When
62
-
63
-
64
-        //Then
65
-
66
-    }
67
-
68
-    @Test
69
-    public void getWalletAmountAfterWager(){
70
-
71
-        //When
72
-        xzavia.setWager(1000.00);
73
-
74
-        double expected = 9000.00;
75
-
76
-        double actual = xzavia.getWalletAmount();
77
-
78
-        //Then
79
-        Assert.assertEquals(expected,actual,0);
80
-
81
-
82
-    }
83
-}