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