|
@@ -1,16 +1,13 @@
|
|
1
|
+import org.junit.Assert;
|
1
|
2
|
import org.junit.Test;
|
2
|
3
|
|
|
4
|
+import java.util.Set;
|
|
5
|
+
|
3
|
6
|
public class BinsTest {
|
4
|
7
|
|
5
|
8
|
Dice testDice;
|
6
|
9
|
Bins testBins;
|
7
|
10
|
|
8
|
|
-
|
9
|
|
- /**
|
10
|
|
- * test to make?
|
11
|
|
- * get bin # { how many in that bin? }
|
12
|
|
- *
|
13
|
|
- */
|
14
|
11
|
public BinsTest() {
|
15
|
12
|
|
16
|
13
|
testDice = new Dice(2);
|
|
@@ -18,14 +15,27 @@ public class BinsTest {
|
18
|
15
|
|
19
|
16
|
}
|
20
|
17
|
|
21
|
|
-
|
22
|
18
|
@Test
|
23
|
19
|
public void testHashMap() {
|
24
|
20
|
|
25
|
|
- for (int key: testBins.results.keySet()) {
|
26
|
|
-
|
|
21
|
+ // Given
|
|
22
|
+ int[] expected = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
|
|
23
|
+ boolean keyMatches = false;
|
|
24
|
+ boolean expectedKey = true;
|
|
25
|
+ int i = 0;
|
|
26
|
+
|
|
27
|
+ // When
|
|
28
|
+ Set<Integer> actual = testBins.results.keySet();
|
|
29
|
+
|
|
30
|
+ for (int key: actual) {
|
|
31
|
+ if (key == expected[i]) {
|
|
32
|
+ keyMatches = true;
|
|
33
|
+ break;
|
|
34
|
+ }
|
|
35
|
+ i++;
|
27
|
36
|
}
|
28
|
37
|
|
29
|
|
-
|
|
38
|
+ // Then
|
|
39
|
+ Assert.assertTrue(keyMatches);
|
30
|
40
|
}
|
31
|
41
|
}
|