|
@@ -50,4 +50,76 @@ public class MySetTest {
|
50
|
50
|
// Then
|
51
|
51
|
Assert.assertEquals(expected, actual);
|
52
|
52
|
}
|
|
53
|
+
|
|
54
|
+ @Test
|
|
55
|
+ public void sizeLongTest() {
|
|
56
|
+ // Given
|
|
57
|
+ int expected = 4;
|
|
58
|
+ Long[] inputArray = {1L, 2L, 8L, 4L};
|
|
59
|
+ MySet<Long> mySet = new MySet<Long>(inputArray);
|
|
60
|
+
|
|
61
|
+ // When
|
|
62
|
+ int actual = mySet.size();
|
|
63
|
+
|
|
64
|
+ // Then
|
|
65
|
+ Assert.assertEquals(expected, actual);
|
|
66
|
+ }
|
|
67
|
+
|
|
68
|
+ @Test
|
|
69
|
+ public void toArrayStringTest() {
|
|
70
|
+ // Given
|
|
71
|
+ Object[] expected = {"1", "2", "8", "4"};
|
|
72
|
+ String[] inputArray = {"1", "2", "8", "4"};
|
|
73
|
+ MySet<String> mySet = new MySet<String>(inputArray);
|
|
74
|
+
|
|
75
|
+ // When
|
|
76
|
+ Object[] actual = mySet.toArray();
|
|
77
|
+
|
|
78
|
+ // Then
|
|
79
|
+ Assert.assertEquals(expected, actual);
|
|
80
|
+ }
|
|
81
|
+
|
|
82
|
+ @Test
|
|
83
|
+ public void removeStringTest() {
|
|
84
|
+ // Given
|
|
85
|
+ String[] expected = {"2", "8", "4"};
|
|
86
|
+ String[] inputArray = {"1", "2", "8", "4"};
|
|
87
|
+ MySet<String> mySet = new MySet<String>(inputArray);
|
|
88
|
+ Object object = "1";
|
|
89
|
+ // When
|
|
90
|
+ mySet.remove(object);
|
|
91
|
+ String[] actual = mySet.get();
|
|
92
|
+
|
|
93
|
+ // Then
|
|
94
|
+ Assert.assertEquals(expected, actual);
|
|
95
|
+ }
|
|
96
|
+
|
|
97
|
+ @Test
|
|
98
|
+ public void removeBooleanReturnStringTest() {
|
|
99
|
+ // Given
|
|
100
|
+ boolean expected = true;
|
|
101
|
+ String[] inputArray = {"1", "2", "8", "4"};
|
|
102
|
+ MySet<String> mySet = new MySet<String>(inputArray);
|
|
103
|
+ Object object = "1";
|
|
104
|
+ // When
|
|
105
|
+ boolean actual = mySet.remove(object);
|
|
106
|
+
|
|
107
|
+ // Then
|
|
108
|
+ Assert.assertEquals(expected, actual);
|
|
109
|
+ }
|
|
110
|
+
|
|
111
|
+ @Test
|
|
112
|
+ public void removeMultipleStringTest() {
|
|
113
|
+ // Given
|
|
114
|
+ String[] expected = {"4"};
|
|
115
|
+ String[] inputArray = {"1", "1", "1", "4"};
|
|
116
|
+ MySet<String> mySet = new MySet<String>(inputArray);
|
|
117
|
+ Object object = "1";
|
|
118
|
+ // When
|
|
119
|
+ mySet.remove(object);
|
|
120
|
+ String[] actual = mySet.get();
|
|
121
|
+
|
|
122
|
+ // Then
|
|
123
|
+ Assert.assertEquals(expected, actual);
|
|
124
|
+ }
|
53
|
125
|
}
|