|
@@ -7,70 +7,70 @@ import org.junit.Test;
|
7
|
7
|
* Created by leon on 3/1/18.
|
8
|
8
|
* The purpose of this class is to thoroughly test the method countDuplicatesInMerge()
|
9
|
9
|
*/
|
10
|
|
-//public class CountDuplicatesInMergeTest {
|
11
|
|
-// @Test
|
12
|
|
-// public void integerTest() {
|
13
|
|
-// // Given
|
14
|
|
-// Integer valueToEvaluate = 7;
|
15
|
|
-// Integer expected = 5;
|
16
|
|
-// Integer[] inputArray = {1, 2, valueToEvaluate, 8, 4, 5, valueToEvaluate, 0, 9, 8, valueToEvaluate};
|
17
|
|
-// Integer[] arrayToMerge = {1, 2, valueToEvaluate, 8, 4, 5, valueToEvaluate, 0, 9, 8};
|
18
|
|
-// ArrayUtility<Integer> arrayUtility = new ArrayUtility<Integer>(inputArray);
|
19
|
|
-//
|
20
|
|
-// // When
|
21
|
|
-// Integer actual = arrayUtility.countDuplicatesInMerge(arrayToMerge, valueToEvaluate);
|
22
|
|
-//
|
23
|
|
-// // Then
|
24
|
|
-// Assert.assertEquals(expected, actual);
|
25
|
|
-// }
|
26
|
|
-//
|
27
|
|
-// @Test
|
28
|
|
-// public void longTest() {
|
29
|
|
-// // Given
|
30
|
|
-// Long valueToEvaluate = 7L;
|
31
|
|
-// Integer expected = 6;
|
32
|
|
-// Long[] inputArray = {1L, 2L, valueToEvaluate, 8L, 4L, 5L, valueToEvaluate, 0L, 9L, 8L, valueToEvaluate};
|
33
|
|
-// Long[] arrayToMerge = {1L, 2L, valueToEvaluate, 8L, 4L, 5L, valueToEvaluate, 0L, 9L, 8L, valueToEvaluate};
|
34
|
|
-// ArrayUtility<Long> arrayUtility = new ArrayUtility<Long>(inputArray);
|
35
|
|
-//
|
36
|
|
-// // When
|
37
|
|
-// Integer actual = arrayUtility.countDuplicatesInMerge(arrayToMerge, valueToEvaluate);
|
38
|
|
-//
|
39
|
|
-// // Then
|
40
|
|
-// Assert.assertEquals(expected, actual);
|
41
|
|
-// }
|
42
|
|
-//
|
43
|
|
-// @Test
|
44
|
|
-// public void stringTest() {
|
45
|
|
-// // Given
|
46
|
|
-// String valueToEvaluate = "a";
|
47
|
|
-// Integer expected = 7;
|
48
|
|
-// String[] inputArray = {"1", "2", valueToEvaluate, "8", "4", "5", valueToEvaluate, "0", "9", "8", valueToEvaluate};
|
49
|
|
-// String[] arrayToMerge = {"1", "2", valueToEvaluate, "8", "4", "5", valueToEvaluate, "0", "9", "8", valueToEvaluate, valueToEvaluate};
|
50
|
|
-//
|
51
|
|
-// ArrayUtility<String> arrayUtility = new ArrayUtility<String>(inputArray);
|
52
|
|
-//
|
53
|
|
-// // When
|
54
|
|
-// Integer actual = arrayUtility.countDuplicatesInMerge(arrayToMerge, valueToEvaluate);
|
55
|
|
-//
|
56
|
|
-// // Then
|
57
|
|
-// Assert.assertEquals(expected, actual);
|
58
|
|
-// }
|
59
|
|
-//
|
60
|
|
-// @Test
|
61
|
|
-// public void objectTest() {
|
62
|
|
-// // Given
|
63
|
|
-// Object valueToEvaluate = "a";
|
64
|
|
-// Integer expected = 8;
|
65
|
|
-// Object[] inputArray = {"1", "2", valueToEvaluate, "8", "4", "5", valueToEvaluate, "0", "9", "8", valueToEvaluate};
|
66
|
|
-// Object[] arrayToMerge = {"1", "2", valueToEvaluate, "8", "4", "5", valueToEvaluate, "0", "9", "8", valueToEvaluate, valueToEvaluate, valueToEvaluate};
|
67
|
|
-//
|
68
|
|
-// ArrayUtility<Object> arrayUtility = new ArrayUtility<Object>(inputArray);
|
69
|
|
-//
|
70
|
|
-// // When
|
71
|
|
-// Integer actual = arrayUtility.countDuplicatesInMerge(arrayToMerge, valueToEvaluate);
|
72
|
|
-//
|
73
|
|
-// // Then
|
74
|
|
-// Assert.assertEquals(expected, actual);
|
75
|
|
-// }
|
76
|
|
-//}
|
|
10
|
+public class CountDuplicatesInMergeTest {
|
|
11
|
+ @Test
|
|
12
|
+ public void integerTest() {
|
|
13
|
+ // Given
|
|
14
|
+ Integer valueToEvaluate = 7;
|
|
15
|
+ Integer expected = 5;
|
|
16
|
+ Integer[] inputArray = {1, 2, valueToEvaluate, 8, 4, 5, valueToEvaluate, 0, 9, 8, valueToEvaluate};
|
|
17
|
+ Integer[] arrayToMerge = {1, 2, valueToEvaluate, 8, 4, 5, valueToEvaluate, 0, 9, 8};
|
|
18
|
+ ArrayUtility<Integer> arrayUtility = new ArrayUtility<Integer>(inputArray);
|
|
19
|
+
|
|
20
|
+ // When
|
|
21
|
+ Integer actual = arrayUtility.countDuplicatesInMerge(arrayToMerge, valueToEvaluate);
|
|
22
|
+
|
|
23
|
+ // Then
|
|
24
|
+ Assert.assertEquals(expected, actual);
|
|
25
|
+ }
|
|
26
|
+
|
|
27
|
+ @Test
|
|
28
|
+ public void longTest() {
|
|
29
|
+ // Given
|
|
30
|
+ Long valueToEvaluate = 7L;
|
|
31
|
+ Integer expected = 6;
|
|
32
|
+ Long[] inputArray = {1L, 2L, valueToEvaluate, 8L, 4L, 5L, valueToEvaluate, 0L, 9L, 8L, valueToEvaluate};
|
|
33
|
+ Long[] arrayToMerge = {1L, 2L, valueToEvaluate, 8L, 4L, 5L, valueToEvaluate, 0L, 9L, 8L, valueToEvaluate};
|
|
34
|
+ ArrayUtility<Long> arrayUtility = new ArrayUtility<Long>(inputArray);
|
|
35
|
+
|
|
36
|
+ // When
|
|
37
|
+ Integer actual = arrayUtility.countDuplicatesInMerge(arrayToMerge, valueToEvaluate);
|
|
38
|
+
|
|
39
|
+ // Then
|
|
40
|
+ Assert.assertEquals(expected, actual);
|
|
41
|
+ }
|
|
42
|
+
|
|
43
|
+ @Test
|
|
44
|
+ public void stringTest() {
|
|
45
|
+ // Given
|
|
46
|
+ String valueToEvaluate = "a";
|
|
47
|
+ Integer expected = 7;
|
|
48
|
+ String[] inputArray = {"1", "2", valueToEvaluate, "8", "4", "5", valueToEvaluate, "0", "9", "8", valueToEvaluate};
|
|
49
|
+ String[] arrayToMerge = {"1", "2", valueToEvaluate, "8", "4", "5", valueToEvaluate, "0", "9", "8", valueToEvaluate, valueToEvaluate};
|
|
50
|
+
|
|
51
|
+ ArrayUtility<String> arrayUtility = new ArrayUtility<String>(inputArray);
|
|
52
|
+
|
|
53
|
+ // When
|
|
54
|
+ Integer actual = arrayUtility.countDuplicatesInMerge(arrayToMerge, valueToEvaluate);
|
|
55
|
+
|
|
56
|
+ // Then
|
|
57
|
+ Assert.assertEquals(expected, actual);
|
|
58
|
+ }
|
|
59
|
+
|
|
60
|
+ @Test
|
|
61
|
+ public void objectTest() {
|
|
62
|
+ // Given
|
|
63
|
+ Object valueToEvaluate = "a";
|
|
64
|
+ Integer expected = 8;
|
|
65
|
+ Object[] inputArray = {"1", "2", valueToEvaluate, "8", "4", "5", valueToEvaluate, "0", "9", "8", valueToEvaluate};
|
|
66
|
+ Object[] arrayToMerge = {"1", "2", valueToEvaluate, "8", "4", "5", valueToEvaluate, "0", "9", "8", valueToEvaluate, valueToEvaluate, valueToEvaluate};
|
|
67
|
+
|
|
68
|
+ ArrayUtility<Object> arrayUtility = new ArrayUtility<Object>(inputArray);
|
|
69
|
+
|
|
70
|
+ // When
|
|
71
|
+ Integer actual = arrayUtility.countDuplicatesInMerge(arrayToMerge, valueToEvaluate);
|
|
72
|
+
|
|
73
|
+ // Then
|
|
74
|
+ Assert.assertEquals(expected, actual);
|
|
75
|
+ }
|
|
76
|
+}
|