|
|
@@ -6,16 +6,14 @@ import org.junit.Test;
|
|
6
|
6
|
public class PokerTest
|
|
7
|
7
|
{
|
|
8
|
8
|
@Test
|
|
9
|
|
- public void OneHand()
|
|
10
|
|
- {
|
|
|
9
|
+ public void oneHand() {
|
|
11
|
10
|
final String hand = "4S 5S 7H 8D JC";
|
|
12
|
11
|
assertEquals(Arrays.asList(hand),Poker.bestHands(Arrays.asList(hand)));
|
|
13
|
12
|
}
|
|
14
|
13
|
|
|
15
|
14
|
@Test
|
|
16
|
15
|
@Ignore
|
|
17
|
|
- public void NothingVsOnePair()
|
|
18
|
|
- {
|
|
|
16
|
+ public void nothingVsOnePair() {
|
|
19
|
17
|
final String nothing = "4S 5H 6S 8D JH";
|
|
20
|
18
|
final String pairOf4 = "2S 4H 6S 4D JH";
|
|
21
|
19
|
assertEquals(Arrays.asList(pairOf4), Poker.bestHands(Arrays.asList(nothing, pairOf4)));
|
|
|
@@ -23,8 +21,7 @@ public class PokerTest
|
|
23
|
21
|
|
|
24
|
22
|
@Test
|
|
25
|
23
|
@Ignore
|
|
26
|
|
- public void TwoPairs()
|
|
27
|
|
- {
|
|
|
24
|
+ public void twoPairs() {
|
|
28
|
25
|
final String pairOf2 = "4S 2H 6S 2D JH";
|
|
29
|
26
|
final String pairOf4 = "2S 4H 6S 4D JH";
|
|
30
|
27
|
assertEquals(Arrays.asList(pairOf4), Poker.bestHands(Arrays.asList(pairOf2,pairOf4)));
|
|
|
@@ -32,8 +29,7 @@ public class PokerTest
|
|
32
|
29
|
|
|
33
|
30
|
@Test
|
|
34
|
31
|
@Ignore
|
|
35
|
|
- public void OnePairVsDoublePair()
|
|
36
|
|
- {
|
|
|
32
|
+ public void onePairVsDoublePair() {
|
|
37
|
33
|
final String pairOf8 = "2S 8H 6S 8D JH";
|
|
38
|
34
|
final String doublePair = "4S 5H 4S 8D 5H";
|
|
39
|
35
|
assertEquals(Arrays.asList(doublePair), Poker.bestHands(Arrays.asList(pairOf8, doublePair)));
|
|
|
@@ -41,8 +37,7 @@ public class PokerTest
|
|
41
|
37
|
|
|
42
|
38
|
@Test
|
|
43
|
39
|
@Ignore
|
|
44
|
|
- public void TwoDoublePairs()
|
|
45
|
|
- {
|
|
|
40
|
+ public void twoDoublePairs() {
|
|
46
|
41
|
final String doublePair2And8 = "2S 8H 2S 8D JH";
|
|
47
|
42
|
final String doublePair4And5 = "4S 5H 4S 8D 5H";
|
|
48
|
43
|
assertEquals(Arrays.asList(doublePair2And8), Poker.bestHands(Arrays.asList(doublePair2And8, doublePair4And5)));
|
|
|
@@ -50,8 +45,7 @@ public class PokerTest
|
|
50
|
45
|
|
|
51
|
46
|
@Test
|
|
52
|
47
|
@Ignore
|
|
53
|
|
- public void DoublePairVsThree()
|
|
54
|
|
- {
|
|
|
48
|
+ public void doublePairVsThree() {
|
|
55
|
49
|
final String doublePair2And8 = "2S 8H 2S 8D JH";
|
|
56
|
50
|
final String threeOf4 = "4S 5H 4S 8D 4H";
|
|
57
|
51
|
assertEquals(Arrays.asList(threeOf4 ), Poker.bestHands(Arrays.asList(doublePair2And8, threeOf4 )));
|
|
|
@@ -59,8 +53,7 @@ public class PokerTest
|
|
59
|
53
|
|
|
60
|
54
|
@Test
|
|
61
|
55
|
@Ignore
|
|
62
|
|
- public void TwoThrees()
|
|
63
|
|
- {
|
|
|
56
|
+ public void twoThrees() {
|
|
64
|
57
|
final String threeOf2 = "2S 2H 2S 8D JH";
|
|
65
|
58
|
final String threeOf1 = "4S AH AS 8D AH";
|
|
66
|
59
|
assertEquals(Arrays.asList(threeOf1), Poker.bestHands(Arrays.asList(threeOf2, threeOf1)));
|
|
|
@@ -68,8 +61,7 @@ public class PokerTest
|
|
68
|
61
|
|
|
69
|
62
|
@Test
|
|
70
|
63
|
@Ignore
|
|
71
|
|
- public void ThreeVsStraight()
|
|
72
|
|
- {
|
|
|
64
|
+ public void threeVsStraight() {
|
|
73
|
65
|
final String threeOf4 = "4S 5H 4S 8D 4H";
|
|
74
|
66
|
final String straight = "3S 4H 2S 6D 5H";
|
|
75
|
67
|
assertEquals(Arrays.asList(straight), Poker.bestHands(Arrays.asList(threeOf4, straight )));
|
|
|
@@ -77,8 +69,7 @@ public class PokerTest
|
|
77
|
69
|
|
|
78
|
70
|
@Test
|
|
79
|
71
|
@Ignore
|
|
80
|
|
- public void TwoStraights()
|
|
81
|
|
- {
|
|
|
72
|
+ public void twoStraights() {
|
|
82
|
73
|
final String straightTo8 = "4S 6H 7S 8D 5H";
|
|
83
|
74
|
final String straightTo9 = "5S 7H 8S 9D 6H";
|
|
84
|
75
|
assertEquals(Arrays.asList(straightTo9 ), Poker.bestHands(Arrays.asList(straightTo8, straightTo9 )));
|
|
|
@@ -90,8 +81,7 @@ public class PokerTest
|
|
90
|
81
|
|
|
91
|
82
|
@Test
|
|
92
|
83
|
@Ignore
|
|
93
|
|
- public void StraightVsFlush()
|
|
94
|
|
- {
|
|
|
84
|
+ public void straightVsFlush() {
|
|
95
|
85
|
final String straightTo8 = "4S 6H 7S 8D 5H";
|
|
96
|
86
|
final String flushTo7 = "2S 4S 5S 6S 7S";
|
|
97
|
87
|
assertEquals(Arrays.asList(flushTo7 ), Poker.bestHands(Arrays.asList(straightTo8, flushTo7 )));
|
|
|
@@ -99,8 +89,7 @@ public class PokerTest
|
|
99
|
89
|
|
|
100
|
90
|
@Test
|
|
101
|
91
|
@Ignore
|
|
102
|
|
- public void TwoFlushes()
|
|
103
|
|
- {
|
|
|
92
|
+ public void twoFlushes() {
|
|
104
|
93
|
final String flushTo8 = "3H 6H 7H 8H 5H";
|
|
105
|
94
|
final String flushTo7 = "2S 4S 5S 6S 7S";
|
|
106
|
95
|
assertEquals(Arrays.asList(flushTo8), Poker.bestHands(Arrays.asList(flushTo8, flushTo7)));
|
|
|
@@ -108,8 +97,7 @@ public class PokerTest
|
|
108
|
97
|
|
|
109
|
98
|
@Test
|
|
110
|
99
|
@Ignore
|
|
111
|
|
- public void FlushVsFull()
|
|
112
|
|
- {
|
|
|
100
|
+ public void flushVsFull() {
|
|
113
|
101
|
final String flushTo8 = "3H 6H 7H 8H 5H";
|
|
114
|
102
|
final String full = "4S 5H 4S 5D 4H";
|
|
115
|
103
|
assertEquals(Arrays.asList(full ), Poker.bestHands(Arrays.asList(full, flushTo8)));
|
|
|
@@ -117,8 +105,7 @@ public class PokerTest
|
|
117
|
105
|
|
|
118
|
106
|
@Test
|
|
119
|
107
|
@Ignore
|
|
120
|
|
- public void TwoFulls()
|
|
121
|
|
- {
|
|
|
108
|
+ public void twoFulls() {
|
|
122
|
109
|
final String fullOf4By9 = "4H 4S 4D 9S 9D";
|
|
123
|
110
|
final String fullOf5By8 = "5H 5S 5D 8S 8D";
|
|
124
|
111
|
assertEquals(Arrays.asList(fullOf5By8 ), Poker.bestHands(Arrays.asList(fullOf4By9, fullOf5By8)));
|
|
|
@@ -126,8 +113,7 @@ public class PokerTest
|
|
126
|
113
|
|
|
127
|
114
|
@Test
|
|
128
|
115
|
@Ignore
|
|
129
|
|
- public void FullVsSquare()
|
|
130
|
|
- {
|
|
|
116
|
+ public void fullVsSquare() {
|
|
131
|
117
|
final String full = "4S 5H 4S 5D 4H";
|
|
132
|
118
|
final String squareOf3 = "3S 3H 2S 3D 3H";
|
|
133
|
119
|
assertEquals(Arrays.asList(squareOf3 ), Poker.bestHands(Arrays.asList(full, squareOf3 )));
|
|
|
@@ -135,8 +121,7 @@ public class PokerTest
|
|
135
|
121
|
|
|
136
|
122
|
@Test
|
|
137
|
123
|
@Ignore
|
|
138
|
|
- public void TwoSquares()
|
|
139
|
|
- {
|
|
|
124
|
+ public void twoSquares() {
|
|
140
|
125
|
final String squareOf2 = "2S 2H 2S 8D 2H";
|
|
141
|
126
|
final String squareOf5 = "4S 5H 5S 5D 5H";
|
|
142
|
127
|
assertEquals(Arrays.asList(squareOf5), Poker.bestHands(Arrays.asList(squareOf2, squareOf5)));
|
|
|
@@ -144,8 +129,7 @@ public class PokerTest
|
|
144
|
129
|
|
|
145
|
130
|
@Test
|
|
146
|
131
|
@Ignore
|
|
147
|
|
- public void SquareVsStraightFlush()
|
|
148
|
|
- {
|
|
|
132
|
+ public void squareVsStraightFlush() {
|
|
149
|
133
|
final String squareOf5 = "4S 5H 5S 5D 5H";
|
|
150
|
134
|
final String straightFlushTo9 = "5S 7S 8S 9S 6S";
|
|
151
|
135
|
assertEquals(Arrays.asList(straightFlushTo9 ), Poker.bestHands(Arrays.asList(squareOf5, straightFlushTo9 )));
|
|
|
@@ -153,8 +137,7 @@ public class PokerTest
|
|
153
|
137
|
|
|
154
|
138
|
@Test
|
|
155
|
139
|
@Ignore
|
|
156
|
|
- public void TwoStraightFlushes()
|
|
157
|
|
- {
|
|
|
140
|
+ public void twoStraightFlushes() {
|
|
158
|
141
|
final String straightFlushTo8 = "4H 6H 7H 8H 5H";
|
|
159
|
142
|
final String straightFlushTo9 = "5S 7S 8S 9S 6S";
|
|
160
|
143
|
assertEquals(Arrays.asList(straightFlushTo9 ), Poker.bestHands(Arrays.asList(straightFlushTo8, straightFlushTo9)));
|
|
|
@@ -162,8 +145,7 @@ public class PokerTest
|
|
162
|
145
|
|
|
163
|
146
|
@Test
|
|
164
|
147
|
@Ignore
|
|
165
|
|
- public void ThreeHandWithTie()
|
|
166
|
|
- {
|
|
|
148
|
+ public void threeHandWithTie() {
|
|
167
|
149
|
final String spadeStraightTo9 = "9S 8S 7S 6S 5S";
|
|
168
|
150
|
final String diamondStraightTo9 = "9D 8D 7D 6D 5D";
|
|
169
|
151
|
final String threeOf4 = "4D 4S 4H QS KS";
|
|
|
@@ -172,8 +154,7 @@ public class PokerTest
|
|
172
|
154
|
|
|
173
|
155
|
@Test
|
|
174
|
156
|
@Ignore
|
|
175
|
|
- public void StraightTo5AgainstAPairOfJacks()
|
|
176
|
|
- {
|
|
|
157
|
+ public void straightTo5AgainstAPairOfJacks() {
|
|
177
|
158
|
final String straightTo5 = "2S 4D 5C 3S AS";
|
|
178
|
159
|
final String twoJacks = "JD 8D 7D JC 5D";
|
|
179
|
160
|
assertEquals(Arrays.asList(straightTo5), Poker.bestHands(Arrays.asList(straightTo5, twoJacks)));
|