瀏覽代碼

poker: remove `final` from tests #1426

Harikrushna Vanpariya 6 年之前
父節點
當前提交
bc4bbde276
共有 1 個文件被更改,包括 40 次插入40 次删除
  1. 40
    40
      exercises/poker/src/test/java/PokerTest.java

+ 40
- 40
exercises/poker/src/test/java/PokerTest.java 查看文件

8
 public class PokerTest {
8
 public class PokerTest {
9
     @Test
9
     @Test
10
     public void oneHand() {
10
     public void oneHand() {
11
-        final String hand = "4S 5S 7H 8D JC";
11
+        String hand = "4S 5S 7H 8D JC";
12
         assertEquals(Arrays.asList(hand), new Poker(Arrays.asList(hand)).getBestHands());
12
         assertEquals(Arrays.asList(hand), new Poker(Arrays.asList(hand)).getBestHands());
13
     }
13
     }
14
 
14
 
15
     @Ignore("Remove to run test")
15
     @Ignore("Remove to run test")
16
     @Test
16
     @Test
17
     public void nothingVsOnePair() {
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
         assertEquals(Arrays.asList(pairOf4), new Poker(Arrays.asList(nothing, pairOf4)).getBestHands());
20
         assertEquals(Arrays.asList(pairOf4), new Poker(Arrays.asList(nothing, pairOf4)).getBestHands());
21
     }
21
     }
22
 
22
 
23
     @Ignore("Remove to run test")
23
     @Ignore("Remove to run test")
24
     @Test
24
     @Test
25
     public void twoPairs() {
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
         assertEquals(Arrays.asList(pairOf4), new Poker(Arrays.asList(pairOf2, pairOf4)).getBestHands());
28
         assertEquals(Arrays.asList(pairOf4), new Poker(Arrays.asList(pairOf2, pairOf4)).getBestHands());
29
     }
29
     }
30
 
30
 
31
     @Ignore("Remove to run test")
31
     @Ignore("Remove to run test")
32
     @Test
32
     @Test
33
     public void onePairVsDoublePair() {
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
         assertEquals(Arrays.asList(doublePair), new Poker(Arrays.asList(pairOf8, doublePair)).getBestHands());
36
         assertEquals(Arrays.asList(doublePair), new Poker(Arrays.asList(pairOf8, doublePair)).getBestHands());
37
     }
37
     }
38
 
38
 
39
     @Ignore("Remove to run test")
39
     @Ignore("Remove to run test")
40
     @Test
40
     @Test
41
     public void twoDoublePairs() {
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
         assertEquals(Arrays.asList(doublePair2And8), new Poker(Arrays.asList(doublePair2And8, doublePair4And5)).getBestHands());
44
         assertEquals(Arrays.asList(doublePair2And8), new Poker(Arrays.asList(doublePair2And8, doublePair4And5)).getBestHands());
45
     }
45
     }
46
 
46
 
47
     @Ignore("Remove to run test")
47
     @Ignore("Remove to run test")
48
     @Test
48
     @Test
49
     public void doublePairVsThree() {
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
         assertEquals(Arrays.asList(threeOf4), new Poker(Arrays.asList(doublePair2And8, threeOf4)).getBestHands());
52
         assertEquals(Arrays.asList(threeOf4), new Poker(Arrays.asList(doublePair2And8, threeOf4)).getBestHands());
53
     }
53
     }
54
 
54
 
55
     @Ignore("Remove to run test")
55
     @Ignore("Remove to run test")
56
     @Test
56
     @Test
57
     public void twoThrees() {
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
         assertEquals(Arrays.asList(threeOf1), new Poker(Arrays.asList(threeOf2, threeOf1)).getBestHands());
60
         assertEquals(Arrays.asList(threeOf1), new Poker(Arrays.asList(threeOf2, threeOf1)).getBestHands());
61
     }
61
     }
62
 
62
 
63
     @Ignore("Remove to run test")
63
     @Ignore("Remove to run test")
64
     @Test
64
     @Test
65
     public void threeVsStraight() {
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
         assertEquals(Arrays.asList(straight), new Poker(Arrays.asList(threeOf4, straight)).getBestHands());
68
         assertEquals(Arrays.asList(straight), new Poker(Arrays.asList(threeOf4, straight)).getBestHands());
69
     }
69
     }
70
 
70
 
71
     @Ignore("Remove to run test")
71
     @Ignore("Remove to run test")
72
     @Test
72
     @Test
73
     public void twoStraights() {
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
         assertEquals(Arrays.asList(straightTo9), new Poker(Arrays.asList(straightTo8, straightTo9)).getBestHands());
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
         assertEquals(Arrays.asList(straightTo1), new Poker(Arrays.asList(straightTo1, straightTo5)).getBestHands());
80
         assertEquals(Arrays.asList(straightTo1), new Poker(Arrays.asList(straightTo1, straightTo5)).getBestHands());
81
     }
81
     }
82
 
82
 
83
     @Ignore("Remove to run test")
83
     @Ignore("Remove to run test")
84
     @Test
84
     @Test
85
     public void straightVsFlush() {
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
         assertEquals(Arrays.asList(flushTo7), new Poker(Arrays.asList(straightTo8, flushTo7)).getBestHands());
88
         assertEquals(Arrays.asList(flushTo7), new Poker(Arrays.asList(straightTo8, flushTo7)).getBestHands());
89
     }
89
     }
90
 
90
 
91
     @Ignore("Remove to run test")
91
     @Ignore("Remove to run test")
92
     @Test
92
     @Test
93
     public void twoFlushes() {
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
         assertEquals(Arrays.asList(flushTo8), new Poker(Arrays.asList(flushTo8, flushTo7)).getBestHands());
96
         assertEquals(Arrays.asList(flushTo8), new Poker(Arrays.asList(flushTo8, flushTo7)).getBestHands());
97
     }
97
     }
98
 
98
 
99
     @Ignore("Remove to run test")
99
     @Ignore("Remove to run test")
100
     @Test
100
     @Test
101
     public void flushVsFull() {
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
         assertEquals(Arrays.asList(full), new Poker(Arrays.asList(full, flushTo8)).getBestHands());
104
         assertEquals(Arrays.asList(full), new Poker(Arrays.asList(full, flushTo8)).getBestHands());
105
     }
105
     }
106
 
106
 
107
     @Ignore("Remove to run test")
107
     @Ignore("Remove to run test")
108
     @Test
108
     @Test
109
     public void twoFulls() {
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
         assertEquals(Arrays.asList(fullOf5By8), new Poker(Arrays.asList(fullOf4By9, fullOf5By8)).getBestHands());
112
         assertEquals(Arrays.asList(fullOf5By8), new Poker(Arrays.asList(fullOf4By9, fullOf5By8)).getBestHands());
113
     }
113
     }
114
 
114
 
115
     @Ignore("Remove to run test")
115
     @Ignore("Remove to run test")
116
     @Test
116
     @Test
117
     public void fullVsSquare() {
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
         assertEquals(Arrays.asList(squareOf3), new Poker(Arrays.asList(full, squareOf3)).getBestHands());
120
         assertEquals(Arrays.asList(squareOf3), new Poker(Arrays.asList(full, squareOf3)).getBestHands());
121
     }
121
     }
122
 
122
 
123
     @Ignore("Remove to run test")
123
     @Ignore("Remove to run test")
124
     @Test
124
     @Test
125
     public void twoSquares() {
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
         assertEquals(Arrays.asList(squareOf5), new Poker(Arrays.asList(squareOf2, squareOf5)).getBestHands());
128
         assertEquals(Arrays.asList(squareOf5), new Poker(Arrays.asList(squareOf2, squareOf5)).getBestHands());
129
     }
129
     }
130
 
130
 
131
     @Ignore("Remove to run test")
131
     @Ignore("Remove to run test")
132
     @Test
132
     @Test
133
     public void squareVsStraightFlush() {
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
         assertEquals(Arrays.asList(straightFlushTo9), new Poker(Arrays.asList(squareOf5, straightFlushTo9)).getBestHands());
136
         assertEquals(Arrays.asList(straightFlushTo9), new Poker(Arrays.asList(squareOf5, straightFlushTo9)).getBestHands());
137
     }
137
     }
138
 
138
 
139
     @Ignore("Remove to run test")
139
     @Ignore("Remove to run test")
140
     @Test
140
     @Test
141
     public void twoStraightFlushes() {
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
         assertEquals(Arrays.asList(straightFlushTo9), new Poker(Arrays.asList(straightFlushTo8, straightFlushTo9)).getBestHands());
144
         assertEquals(Arrays.asList(straightFlushTo9), new Poker(Arrays.asList(straightFlushTo8, straightFlushTo9)).getBestHands());
145
     }
145
     }
146
 
146
 
147
     @Ignore("Remove to run test")
147
     @Ignore("Remove to run test")
148
     @Test
148
     @Test
149
     public void threeHandWithTie() {
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
         assertEquals(Arrays.asList(spadeStraightTo9, diamondStraightTo9), new Poker(Arrays.asList(spadeStraightTo9, diamondStraightTo9, threeOf4)).getBestHands());
153
         assertEquals(Arrays.asList(spadeStraightTo9, diamondStraightTo9), new Poker(Arrays.asList(spadeStraightTo9, diamondStraightTo9, threeOf4)).getBestHands());
154
     }
154
     }
155
 
155
 
156
     @Ignore("Remove to run test")
156
     @Ignore("Remove to run test")
157
     @Test
157
     @Test
158
     public void straightTo5AgainstAPairOfJacks() {
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
         assertEquals(Arrays.asList(straightTo5), new Poker(Arrays.asList(straightTo5, twoJacks)).getBestHands());
161
         assertEquals(Arrays.asList(straightTo5), new Poker(Arrays.asList(straightTo5, twoJacks)).getBestHands());
162
     }
162
     }
163
 }
163
 }