Procházet zdrojové kódy

go-counting: use provided enumeration instead of Strings

Use of enumeration should be consistent across the test suite.
Corey McCandless před 6 roky
rodič
revize
d83eed030b
No account linked to committer's email

+ 12
- 12
exercises/go-counting/src/test/java/GoCountingTest.java Zobrazit soubor

@@ -121,15 +121,15 @@ public class GoCountingTest {
121 121
 	public void oneTerritoryIsWholeBoardTest() {
122 122
 		GoCounting gocounting = new GoCounting(" ");
123 123
 		
124
-		HashMap<String, Set<Point>> territories = new HashMap<>();
124
+		HashMap<Player, Set<Point>> territories = new HashMap<>();
125 125
 		Set<Point> blackTerritory = new HashSet<>();
126 126
 		Set<Point> whiteTerritory = new HashSet<>();
127 127
 		Set<Point> noneTerritory = new HashSet<>();
128 128
 		noneTerritory.add(new Point(0, 0));
129 129
 		
130
-		territories.put("BLACK", blackTerritory);
131
-		territories.put("WHITE", whiteTerritory);
132
-		territories.put("NONE", noneTerritory);
130
+		territories.put(Player.BLACK, blackTerritory);
131
+		territories.put(Player.WHITE, whiteTerritory);
132
+		territories.put(Player.NONE, noneTerritory);
133 133
 		
134 134
 		assertEquals(territories, gocounting.getTerritories());
135 135
 	}
@@ -149,10 +149,10 @@ public class GoCountingTest {
149 149
 		
150 150
 		Set<Point> noneTerritory = new HashSet<>();
151 151
 		
152
-		HashMap<String, Set<Point>> territories = new HashMap<>();
153
-		territories.put("BLACK", blackTerritory);
154
-		territories.put("WHITE", whiteTerritory);
155
-		territories.put("NONE", noneTerritory);
152
+		HashMap<Player, Set<Point>> territories = new HashMap<>();
153
+		territories.put(Player.BLACK, blackTerritory);
154
+		territories.put(Player.WHITE, whiteTerritory);
155
+		territories.put(Player.NONE, noneTerritory);
156 156
 		
157 157
 		assertEquals(territories, gocounting.getTerritories());
158 158
 	}
@@ -162,16 +162,16 @@ public class GoCountingTest {
162 162
 	public void twoRegionRectangularBoardTest() {
163 163
 		GoCounting gocounting = new GoCounting(" B ");
164 164
 		
165
-		HashMap<String, Set<Point>> territories = new HashMap<>();
165
+		HashMap<Player, Set<Point>> territories = new HashMap<>();
166 166
 		Set<Point> blackTerritory = new HashSet<>();
167 167
 		blackTerritory.add(new Point(0, 0));
168 168
 		blackTerritory.add(new Point(2, 0));
169 169
 		Set<Point> whiteTerritory = new HashSet<>();
170 170
 		Set<Point> noneTerritory = new HashSet<>();
171 171
 		
172
-		territories.put("BLACK", blackTerritory);
173
-		territories.put("WHITE", whiteTerritory);
174
-		territories.put("NONE", noneTerritory);
172
+		territories.put(Player.BLACK, blackTerritory);
173
+		territories.put(Player.WHITE, whiteTerritory);
174
+		territories.put(Player.NONE, noneTerritory);
175 175
 		
176 176
 		assertEquals(territories, gocounting.getTerritories());
177 177
 	}