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