|
|
@@ -1,10 +1,7 @@
|
|
1
|
1
|
import org.junit.Ignore;
|
|
2
|
2
|
import org.junit.Test;
|
|
3
|
3
|
|
|
4
|
|
-import java.util.ArrayList;
|
|
5
|
|
-import java.util.Arrays;
|
|
6
|
|
-import java.util.Collections;
|
|
7
|
|
-import java.util.List;
|
|
|
4
|
+import java.util.*;
|
|
8
|
5
|
|
|
9
|
6
|
import static org.junit.Assert.assertEquals;
|
|
10
|
7
|
|
|
|
@@ -18,7 +15,7 @@ public class MatrixTest {
|
|
18
|
15
|
Arrays.asList(6, 6, 7)
|
|
19
|
16
|
));
|
|
20
|
17
|
|
|
21
|
|
- List<MatrixCoordinate> expectedSaddlePoints = Collections.singletonList(new MatrixCoordinate(1, 0));
|
|
|
18
|
+ Set<MatrixCoordinate> expectedSaddlePoints = Collections.singleton(new MatrixCoordinate(1, 0));
|
|
22
|
19
|
|
|
23
|
20
|
assertEquals(expectedSaddlePoints, matrix.getSaddlePoints());
|
|
24
|
21
|
}
|
|
|
@@ -28,7 +25,7 @@ public class MatrixTest {
|
|
28
|
25
|
public void testCanIdentifyThatEmptyMatrixHasNoSaddlePoints() {
|
|
29
|
26
|
Matrix matrix = new Matrix(new ArrayList<>());
|
|
30
|
27
|
|
|
31
|
|
- List<MatrixCoordinate> expectedSaddlePoints = new ArrayList<>();
|
|
|
28
|
+ Set<MatrixCoordinate> expectedSaddlePoints = Collections.emptySet();
|
|
32
|
29
|
|
|
33
|
30
|
assertEquals(expectedSaddlePoints, matrix.getSaddlePoints());
|
|
34
|
31
|
}
|
|
|
@@ -42,7 +39,7 @@ public class MatrixTest {
|
|
42
|
39
|
Arrays.asList(2, 3, 1)
|
|
43
|
40
|
));
|
|
44
|
41
|
|
|
45
|
|
- List<MatrixCoordinate> expectedSaddlePoints = new ArrayList<>();
|
|
|
42
|
+ Set<MatrixCoordinate> expectedSaddlePoints = Collections.emptySet();
|
|
46
|
43
|
|
|
47
|
44
|
assertEquals(expectedSaddlePoints, matrix.getSaddlePoints());
|
|
48
|
45
|
}
|
|
|
@@ -56,11 +53,11 @@ public class MatrixTest {
|
|
56
|
53
|
Arrays.asList(1, 5, 4)
|
|
57
|
54
|
));
|
|
58
|
55
|
|
|
59
|
|
- List<MatrixCoordinate> expectedSaddlePoints = Arrays.asList(
|
|
|
56
|
+ Set<MatrixCoordinate> expectedSaddlePoints = new HashSet<>(Arrays.asList(
|
|
60
|
57
|
new MatrixCoordinate(0, 1),
|
|
61
|
58
|
new MatrixCoordinate(1, 1),
|
|
62
|
59
|
new MatrixCoordinate(2, 1)
|
|
63
|
|
- );
|
|
|
60
|
+ ));
|
|
64
|
61
|
|
|
65
|
62
|
assertEquals(expectedSaddlePoints, matrix.getSaddlePoints());
|
|
66
|
63
|
}
|
|
|
@@ -74,7 +71,7 @@ public class MatrixTest {
|
|
74
|
71
|
Arrays.asList(3, 2, 5)
|
|
75
|
72
|
));
|
|
76
|
73
|
|
|
77
|
|
- List<MatrixCoordinate> expectedSaddlePoints = Collections.singletonList(new MatrixCoordinate(2, 2));
|
|
|
74
|
+ Set<MatrixCoordinate> expectedSaddlePoints = Collections.singleton(new MatrixCoordinate(2, 2));
|
|
78
|
75
|
|
|
79
|
76
|
assertEquals(expectedSaddlePoints, matrix.getSaddlePoints());
|
|
80
|
77
|
}
|