|
@@ -1,76 +0,0 @@
|
1
|
|
-package io.zipcoder.casino;
|
2
|
|
-
|
3
|
|
-import org.junit.Assert;
|
4
|
|
-import org.junit.Test;
|
5
|
|
-
|
6
|
|
-import java.util.ArrayList;
|
7
|
|
-import java.util.List;
|
8
|
|
-
|
9
|
|
-public class HandTest {
|
10
|
|
-
|
11
|
|
- @Test
|
12
|
|
- public void testAdd(){
|
13
|
|
-
|
14
|
|
- //Given
|
15
|
|
- Card expected = new Card(Suit.Diamond, Rank.Ace);
|
16
|
|
- Hand hand = new Hand();
|
17
|
|
-
|
18
|
|
- //When
|
19
|
|
- hand.add(expected);
|
20
|
|
- //Then
|
21
|
|
- Assert.assertTrue(hand.contains(expected));
|
22
|
|
- }
|
23
|
|
-
|
24
|
|
- @Test
|
25
|
|
- public void testGetValue(){
|
26
|
|
-
|
27
|
|
- //Given
|
28
|
|
- Card card1 = new Card(Suit.Diamond, Rank.Ace);
|
29
|
|
- Card card2 = new Card(Suit.Spade, Rank.King);
|
30
|
|
- Hand hand = new Hand();
|
31
|
|
- hand.add(card1);
|
32
|
|
- hand.add(card2);
|
33
|
|
- Integer expectedValue = 11;
|
34
|
|
-
|
35
|
|
- //when
|
36
|
|
- Integer actual = hand.getValue();
|
37
|
|
- //then
|
38
|
|
- Assert.assertEquals(expectedValue, actual);
|
39
|
|
- }
|
40
|
|
-
|
41
|
|
- @Test
|
42
|
|
- public void testGetCards(){
|
43
|
|
- //Given
|
44
|
|
- Hand hand= new Hand();
|
45
|
|
- Card card1 = new Card(Suit.Diamond, Rank.Ace);
|
46
|
|
- Card card2 = new Card(Suit.Spade, Rank.King);
|
47
|
|
- hand.add(card1);
|
48
|
|
- hand.add(card2);
|
49
|
|
-
|
50
|
|
- //When
|
51
|
|
- List<Card> s = hand.getCards();
|
52
|
|
-
|
53
|
|
- Assert.assertNotNull(s);
|
54
|
|
- Assert.assertTrue(s.size() == 2);
|
55
|
|
-
|
56
|
|
-
|
57
|
|
-
|
58
|
|
-
|
59
|
|
- }
|
60
|
|
-
|
61
|
|
- @Test
|
62
|
|
- public void testContains(){
|
63
|
|
- //Given
|
64
|
|
- Hand hand = new Hand();
|
65
|
|
- Card card1 = new Card(Suit.Diamond, Rank.Ace);
|
66
|
|
- hand.add(card1);
|
67
|
|
-
|
68
|
|
- //When
|
69
|
|
- Boolean b = hand.contains(card1);
|
70
|
|
-
|
71
|
|
- //Then
|
72
|
|
- Assert.assertTrue(b);
|
73
|
|
- }
|
74
|
|
-
|
75
|
|
-
|
76
|
|
-}
|