Quellcode durchsuchen

custom-set: use generics and tidy up tests

Frida Tveit vor 9 Jahren
Ursprung
Commit
716cc180e6
1 geänderte Dateien mit 103 neuen und 251 gelöschten Zeilen
  1. 103
    251
      exercises/custom-set/src/test/java/CustomSetTest.java

+ 103
- 251
exercises/custom-set/src/test/java/CustomSetTest.java Datei anzeigen

@@ -1,264 +1,181 @@
1
+import org.junit.Ignore;
2
+import org.junit.Test;
1 3
 
2 4
 import java.util.Arrays;
3 5
 import java.util.Collections;
4
-import static org.junit.Assert.assertFalse;
5
-import static org.junit.Assert.assertNotNull;
6
-import static org.junit.Assert.assertTrue;
7
-import org.junit.Test;
8
-import org.junit.Ignore;
6
+
7
+import static org.junit.Assert.*;
9 8
 
10 9
 public class CustomSetTest {
11 10
 
12 11
     @Test
13 12
     public void setsWithNoElementsAreEmpty() {
14
-        final boolean actual
15
-                = new CustomSet<>(Collections.emptyList())
16
-                        .isEmpty();
17
-        assertTrue(actual);
13
+        CustomSet<Integer> customSet = new CustomSet<>(Collections.emptyList());
14
+        assertTrue(customSet.isEmpty());
18 15
     }
19 16
 
20 17
     @Ignore("Remove to run test")
21 18
     @Test
22 19
     public void setsWithElementsAreNotEmpty() {
23
-        final boolean actual
24
-                = new CustomSet<>(Collections.singletonList(1))
25
-                        .isEmpty();
26
-
27
-        assertFalse(actual);
20
+        CustomSet<Integer> customSet = new CustomSet<>(Collections.singletonList(1));
21
+        assertFalse(customSet.isEmpty());
28 22
     }
29 23
 
30 24
     @Ignore("Remove to run test")
31 25
     @Test
32 26
     public void nothingIsContainedInAnEmptySet() {
33
-        final boolean actual
34
-                = new CustomSet<>(Collections.emptyList())
35
-                        .contains(1);
36
-
37
-        assertFalse(actual);
27
+        CustomSet<Character> customSet = new CustomSet<>(Collections.emptyList());
28
+        assertFalse(customSet.contains('1'));
38 29
     }
39 30
 
40 31
     @Ignore("Remove to run test")
41 32
     @Test
42 33
     public void whenTheElementIsInTheSet() {
43
-        final boolean actual
44
-                = new CustomSet<>(Arrays.asList(1, 2, 3))
45
-                        .contains(1);
46
-
47
-        assertTrue(actual);
34
+        CustomSet<String> customSet = new CustomSet<>(Arrays.asList("1", "2", "3"));
35
+        assertTrue(customSet.contains("1"));
48 36
     }
49 37
 
50 38
     @Ignore("Remove to run test")
51 39
     @Test
52 40
     public void whenTheElementIsNotInTheSet() {
53
-        final boolean actual
54
-                = new CustomSet<>(Arrays.asList(1, 2, 3))
55
-                        .contains(4);
56
-
57
-        assertFalse(actual);
41
+        CustomSet<Integer> customSet = new CustomSet<>(Arrays.asList(1, 2, 3));
42
+        assertFalse(customSet.contains(4));
58 43
     }
59 44
 
60 45
     @Ignore("Remove to run test")
61 46
     @Test
62 47
     public void emptySetIsASubsetOfAnotherEmptySet() {
63
-        final boolean actual
64
-                = new CustomSet<>(Collections.emptyList())
65
-                        .isSubset(
66
-                                new CustomSet<>(Collections.emptyList())
67
-                        );
68
-
69
-        assertTrue(actual);
48
+        CustomSet<Integer> customSet = new CustomSet<>(Collections.emptyList());
49
+        CustomSet<Integer> secondCustomSet = new CustomSet<>(Collections.emptyList());
50
+        assertTrue(customSet.isSubset(secondCustomSet));
70 51
     }
71 52
 
72 53
     @Ignore("Remove to run test")
73 54
     @Test
74 55
     public void emptySetIsASubsetOfNonEmptySet() {
75
-        final boolean actual
76
-                = new CustomSet<>(Collections.singletonList(1))
77
-                        .isSubset(
78
-                                new CustomSet<>(Collections.emptyList())
79
-                        );
80
-
81
-        assertTrue(actual);
56
+        CustomSet<Character> customSet = new CustomSet<>(Collections.singletonList('1'));
57
+        CustomSet<Character> secondCustomSet = new CustomSet<>(Collections.emptyList());
58
+        assertTrue(customSet.isSubset(secondCustomSet));
82 59
     }
83 60
 
84 61
     @Ignore("Remove to run test")
85 62
     @Test
86 63
     public void nonEmptySetIsNotASubsetOfEmptySet() {
87
-        final boolean actual
88
-                = new CustomSet<>(Collections.emptyList())
89
-                        .isSubset(
90
-                                new CustomSet<>(Collections.singletonList(1))
91
-                        );
92
-
93
-        assertFalse(actual);
64
+        CustomSet<Character> customSet = new CustomSet<>(Collections.emptyList());
65
+        CustomSet<Character> secondCustomSet = new CustomSet<>(Collections.singletonList('1'));
66
+        assertFalse(customSet.isSubset(secondCustomSet));
94 67
     }
95 68
 
96 69
     @Ignore("Remove to run test")
97 70
     @Test
98 71
     public void setIsASubsetOfSetWithExactSameElements() {
99
-        final boolean actual
100
-                = new CustomSet<>(Arrays.asList(1, 2, 3))
101
-                        .isSubset(
102
-                                new CustomSet<>(Arrays.asList(1, 2, 3))
103
-                        );
104
-
105
-        assertTrue(actual);
72
+        CustomSet<String> customSet = new CustomSet<>(Arrays.asList("1", "2", "3"));
73
+        CustomSet<String> secondCustomSet = new CustomSet<>(Arrays.asList("1", "2", "3"));
74
+        assertTrue(customSet.isSubset(secondCustomSet));
106 75
     }
107 76
 
108 77
     @Ignore("Remove to run test")
109 78
     @Test
110 79
     public void setIsASubsetOfLargerSetWithSameElements() {
111
-        final boolean actual
112
-                = new CustomSet<>(Arrays.asList(4, 1, 2, 3))
113
-                        .isSubset(
114
-                                new CustomSet<>(Arrays.asList(1, 2, 3))
115
-                        );
116
-
117
-        assertTrue(actual);
80
+        CustomSet<Integer> customSet = new CustomSet<>(Arrays.asList(4, 1, 2, 3));
81
+        CustomSet<Integer> secondCustomSet = new CustomSet<>(Arrays.asList(1, 2, 3));
82
+        assertTrue(customSet.isSubset(secondCustomSet));
118 83
     }
119 84
 
120 85
     @Ignore("Remove to run test")
121 86
     @Test
122 87
     public void setIsNotASubsetOfSetThatDoesNotContainItsElements() {
123
-        final boolean actual
124
-                = new CustomSet<>(Arrays.asList(4, 1, 3))
125
-                        .isSubset(
126
-                                new CustomSet<>(Arrays.asList(1, 2, 3))
127
-                        );
128
-
129
-        assertFalse(actual);
88
+        CustomSet<Integer> customSet = new CustomSet<>(Arrays.asList(4, 1, 3));
89
+        CustomSet<Integer> secondCustomSet = new CustomSet<>(Arrays.asList(1, 2, 3));
90
+        assertFalse(customSet.isSubset(secondCustomSet));
130 91
     }
131 92
 
132 93
     @Ignore("Remove to run test")
133 94
     @Test
134 95
     public void theEmptySetIsDisjointWithItself() {
135
-        final boolean actual
136
-                = new CustomSet<>(Collections.emptyList())
137
-                        .isDisjoint(
138
-                                new CustomSet<>(Collections.emptyList())
139
-                        );
140
-
141
-        assertTrue(actual);
96
+        CustomSet<Integer> customSet = new CustomSet<>(Collections.emptyList());
97
+        CustomSet<Integer> secondCustomSet = new CustomSet<>(Collections.emptyList());
98
+        assertTrue(customSet.isDisjoint(secondCustomSet));
142 99
     }
143 100
 
144 101
     @Ignore("Remove to run test")
145 102
     @Test
146 103
     public void emptySetIsDisjointWithNonEmptySet() {
147
-        final boolean actual
148
-                = new CustomSet<>(Collections.emptyList())
149
-                        .isDisjoint(
150
-                                new CustomSet<>(Collections.singletonList(1))
151
-                        );
152
-
153
-        assertTrue(actual);
104
+        CustomSet<Integer> customSet = new CustomSet<>(Collections.emptyList());
105
+        CustomSet<Integer> secondCustomSet = new CustomSet<>(Collections.singletonList(1));
106
+        assertTrue(customSet.isDisjoint(secondCustomSet));
154 107
     }
155 108
 
156 109
     @Ignore("Remove to run test")
157 110
     @Test
158 111
     public void nonEmptySetIsDisjointWithEmptySet() {
159
-        final boolean actual
160
-                = new CustomSet<>(Collections.singletonList(1))
161
-                        .isDisjoint(
162
-                                new CustomSet<>(Collections.emptyList())
163
-                        );
164
-
165
-        assertTrue(actual);
112
+        CustomSet<Character> customSet = new CustomSet<>(Collections.singletonList('1'));
113
+        CustomSet<Character> secondCustomSet = new CustomSet<>(Collections.emptyList());
114
+        assertTrue(customSet.isDisjoint(secondCustomSet));
166 115
     }
167 116
 
168 117
     @Ignore("Remove to run test")
169 118
     @Test
170 119
     public void setsAreNotDisjointIfTheyShareAnElement() {
171
-        final boolean actual
172
-                = new CustomSet<>(Arrays.asList(1, 2))
173
-                        .isDisjoint(
174
-                                new CustomSet<>(Arrays.asList(2, 3))
175
-                        );
176
-
177
-        assertFalse(actual);
120
+        CustomSet<Character> customSet = new CustomSet<>(Arrays.asList('1', '2'));
121
+        CustomSet<Character> secondCustomSet = new CustomSet<>(Arrays.asList('2', '3'));
122
+        assertFalse(customSet.isDisjoint(secondCustomSet));
178 123
     }
179 124
 
180 125
     @Ignore("Remove to run test")
181 126
     @Test
182 127
     public void setsAreDisjointIfTheyShareNoElements() {
183
-        final boolean actual
184
-                = new CustomSet<>(Arrays.asList(1, 2))
185
-                        .isDisjoint(
186
-                                new CustomSet<>(Arrays.asList(3, 4))
187
-                        );
188
-
189
-        assertTrue(actual);
128
+        CustomSet<String> customSet = new CustomSet<>(Arrays.asList("1", "2"));
129
+        CustomSet<String> secondCustomSet = new CustomSet<>(Arrays.asList("3", "4"));
130
+        assertTrue(customSet.isDisjoint(secondCustomSet));
190 131
     }
191 132
 
192 133
     @Ignore("Remove to run test")
193 134
     @Test
194 135
     public void emptySetsAreEqual() {
195
-        final boolean actual
196
-                = new CustomSet<>(Collections.emptyList())
197
-                        .equals(
198
-                                new CustomSet<>(Collections.emptyList())
199
-                        );
200
-
201
-        assertTrue(actual);
136
+        CustomSet<String> customSet = new CustomSet<>(Collections.emptyList());
137
+        CustomSet<String> secondCustomSet = new CustomSet<>(Collections.emptyList());
138
+        assertTrue(customSet.equals(secondCustomSet));
202 139
     }
203 140
 
204 141
     @Ignore("Remove to run test")
205 142
     @Test
206 143
     public void emptySetIsNotEqualToNonEmptySet() {
207
-        final boolean actual
208
-                = new CustomSet<>(Collections.emptyList())
209
-                        .equals(
210
-                                new CustomSet<>(Arrays.asList(1, 2, 3))
211
-                        );
212
-
213
-        assertFalse(actual);
144
+        CustomSet<Integer> customSet = new CustomSet<>(Collections.emptyList());
145
+        CustomSet<Integer> secondCustomSet = new CustomSet<>(Arrays.asList(1, 2, 3));
146
+        assertFalse(customSet.equals(secondCustomSet));
214 147
     }
215 148
 
216 149
     @Ignore("Remove to run test")
217 150
     @Test
218 151
     public void nonEmptySetIsNotEqualToEmptySet() {
219
-        final boolean actual
220
-                = new CustomSet<>(Arrays.asList(1, 2, 3))
221
-                        .equals(
222
-                                new CustomSet<>(Collections.emptyList())
223
-                        );
224
-
225
-        assertFalse(actual);
152
+        CustomSet<Integer> customSet = new CustomSet<>(Arrays.asList(1, 2, 3));
153
+        CustomSet<Integer> secondCustomSet = new CustomSet<>(Collections.emptyList());
154
+        assertFalse(customSet.equals(secondCustomSet));
226 155
     }
227 156
 
228 157
     @Ignore("Remove to run test")
229 158
     @Test
230 159
     public void setsWithTheSameElementsAreEqual() {
231
-        final boolean actual
232
-                = new CustomSet<>(Arrays.asList(1, 2))
233
-                        .equals(
234
-                                new CustomSet<>(Arrays.asList(2, 1))
235
-                        );
236
-
237
-        assertTrue(actual);
160
+        CustomSet<Integer> customSet = new CustomSet<>(Arrays.asList(1, 2));
161
+        CustomSet<Integer> secondCustomSet = new CustomSet<>(Arrays.asList(2, 1));
162
+        assertTrue(customSet.equals(secondCustomSet));
238 163
     }
239 164
 
240 165
     @Ignore("Remove to run test")
241 166
     @Test
242 167
     public void setsWithDifferentElementsAreNotEqual() {
243
-        final boolean actual
244
-                = new CustomSet<>(Arrays.asList(1, 2, 3))
245
-                        .equals(
246
-                                new CustomSet<>(Arrays.asList(1, 2, 4))
247
-                        );
248
-
249
-        assertFalse(actual);
168
+        CustomSet<Integer> customSet = new CustomSet<>(Arrays.asList(1, 2, 3));
169
+        CustomSet<Integer> secondCustomSet = new CustomSet<>(Arrays.asList(2, 1, 4));
170
+        assertFalse(customSet.equals(secondCustomSet));
250 171
     }
251 172
 
252 173
     @Ignore("Remove to run test")
253 174
     @Test
254 175
     public void addToEmptySet() {
255
-        final int element = 3;
256
-        final CustomSet<Integer> expected
257
-                = new CustomSet<>(
258
-                        Collections.unmodifiableList(Collections.singletonList(element))
259
-                );
260
-        final CustomSet<Integer> actual
261
-                = new CustomSet<>(Collections.emptyList());
176
+        char element = '3';
177
+        CustomSet<Character> expected = new CustomSet<>(Collections.unmodifiableList(Collections.singletonList(element)));
178
+        CustomSet<Character> actual = new CustomSet<>(Collections.emptyList());
262 179
 
263 180
         actual.add(element);
264 181
 
@@ -270,13 +187,9 @@ public class CustomSetTest {
270 187
     @Ignore("Remove to run test")
271 188
     @Test
272 189
     public void addToNonEmptySet() {
273
-        final int element = 3;
274
-        final CustomSet<Integer> expected
275
-                = new CustomSet<>(
276
-                        Collections.unmodifiableList(Arrays.asList(1, 2, 3, 4))
277
-                );
278
-        final CustomSet<Integer> actual
279
-                = new CustomSet<>(Arrays.asList(1, 2, 4));
190
+        int element = 3;
191
+        CustomSet<Integer> expected = new CustomSet<>(Collections.unmodifiableList(Arrays.asList(1, 2, 3, 4)));
192
+        CustomSet<Integer> actual = new CustomSet<>(Arrays.asList(1, 2, 4));
280 193
 
281 194
         actual.add(element);
282 195
 
@@ -288,13 +201,9 @@ public class CustomSetTest {
288 201
     @Ignore("Remove to run test")
289 202
     @Test
290 203
     public void addingAnExistingElementDoesNotChangeTheSet() {
291
-        final int element = 3;
292
-        final CustomSet<Integer> expected
293
-                = new CustomSet<>(
294
-                        Collections.unmodifiableList(Arrays.asList(1, 2, 3))
295
-                );
296
-        final CustomSet<Integer> actual
297
-                = new CustomSet<>(Arrays.asList(1, 2, 3));
204
+        String element = "3";
205
+        CustomSet<String> expected = new CustomSet<>(Collections.unmodifiableList(Arrays.asList("1", "2", "3")));
206
+        CustomSet<String> actual = new CustomSet<>(Arrays.asList("1", "2", "3"));
298 207
 
299 208
         actual.add(element);
300 209
 
@@ -305,11 +214,8 @@ public class CustomSetTest {
305 214
     @Ignore("Remove to run test")
306 215
     @Test
307 216
     public void intersectionOfTwoEmptySetsIsAnEmptySet() {
308
-        final CustomSet<Integer> actual
309
-                = new CustomSet<Integer>(Collections.emptyList())
310
-                        .getIntersection(
311
-                                new CustomSet<>(Collections.emptyList())
312
-                        );
217
+        CustomSet<Integer> actual = new CustomSet<Integer>(Collections.emptyList())
218
+                .getIntersection(new CustomSet<>(Collections.emptyList()));
313 219
 
314 220
         assertNotNull(actual);
315 221
         assertTrue(actual.isEmpty());
@@ -318,11 +224,8 @@ public class CustomSetTest {
318 224
     @Ignore("Remove to run test")
319 225
     @Test
320 226
     public void intersectionOfAnEmptySetAndNonEmptySetIsAnEmptySet() {
321
-        final CustomSet<Integer> actual
322
-                = new CustomSet<Integer>(Collections.emptyList())
323
-                        .getIntersection(
324
-                                new CustomSet<>(Arrays.asList(3, 2, 5))
325
-                        );
227
+        CustomSet<Integer> actual = new CustomSet<Integer>(Collections.emptyList())
228
+                .getIntersection(new CustomSet<>(Arrays.asList(3, 2, 5)));
326 229
 
327 230
         assertNotNull(actual);
328 231
         assertTrue(actual.isEmpty());
@@ -331,11 +234,8 @@ public class CustomSetTest {
331 234
     @Ignore("Remove to run test")
332 235
     @Test
333 236
     public void intersectionOfANonEmptySetAndAnEmptySetIsAnEmptySet() {
334
-        final CustomSet<Integer> actual
335
-                = new CustomSet<>(Arrays.asList(1, 2, 3, 4))
336
-                        .getIntersection(
337
-                                new CustomSet<>(Collections.emptyList())
338
-                        );
237
+        CustomSet<Character> actual = new CustomSet<>(Arrays.asList('1', '2', '3', '4'))
238
+                .getIntersection(new CustomSet<>(Collections.emptyList()));
339 239
 
340 240
         assertNotNull(actual);
341 241
         assertTrue(actual.isEmpty());
@@ -345,11 +245,8 @@ public class CustomSetTest {
345 245
     @Ignore("Remove to run test")
346 246
     @Test
347 247
     public void intersectionOfTwoSetsWithNoSharedElementsIsAnEmptySet() {
348
-        final CustomSet<Integer> actual
349
-                = new CustomSet<>(Arrays.asList(1, 2, 3))
350
-                        .getIntersection(
351
-                                new CustomSet<>(Arrays.asList(4, 5, 6))
352
-                        );
248
+        CustomSet<Integer> actual = new CustomSet<>(Arrays.asList(1, 2, 3))
249
+                .getIntersection(new CustomSet<>(Arrays.asList(4, 5, 6)));
353 250
 
354 251
         assertNotNull(actual);
355 252
         assertTrue(actual.isEmpty());
@@ -358,15 +255,9 @@ public class CustomSetTest {
358 255
     @Ignore("Remove to run test")
359 256
     @Test
360 257
     public void intersectionOfTwoSetsWithSharedElementsIsASetOfTheSharedElements() {
361
-        final CustomSet<Integer> expected
362
-                = new CustomSet<>(
363
-                        Collections.unmodifiableList(Arrays.asList(2, 3))
364
-                );
365
-        final CustomSet<Integer> actual
366
-                = new CustomSet<>(Arrays.asList(1, 2, 3, 4))
367
-                        .getIntersection(
368
-                                new CustomSet<>(Arrays.asList(3, 2, 5))
369
-                        );
258
+        CustomSet<Integer> expected = new CustomSet<>(Collections.unmodifiableList(Arrays.asList(2, 3)));
259
+        CustomSet<Integer> actual = new CustomSet<>(Arrays.asList(1, 2, 3, 4))
260
+                .getIntersection(new CustomSet<>(Arrays.asList(3, 2, 5)));
370 261
 
371 262
         assertNotNull(actual);
372 263
         assertFalse(actual.isEmpty());
@@ -376,11 +267,8 @@ public class CustomSetTest {
376 267
     @Ignore("Remove to run test")
377 268
     @Test
378 269
     public void differenceOfTwoEmptySetsIsAnEmptySet() {
379
-        final CustomSet<Integer> actual
380
-                = new CustomSet<Integer>(Collections.emptyList())
381
-                        .getDifference(
382
-                                new CustomSet<>(Collections.emptyList())
383
-                        );
270
+        CustomSet<Integer> actual = new CustomSet<Integer>(Collections.emptyList())
271
+                .getDifference(new CustomSet<>(Collections.emptyList()));
384 272
 
385 273
         assertNotNull(actual);
386 274
         assertTrue(actual.isEmpty());
@@ -389,11 +277,8 @@ public class CustomSetTest {
389 277
     @Ignore("Remove to run test")
390 278
     @Test
391 279
     public void differenceOfAnEmptySetAndNonEmptySetIsAnEmptySet() {
392
-        final CustomSet<Integer> actual
393
-                = new CustomSet<Integer>(Collections.emptyList())
394
-                        .getDifference(
395
-                                new CustomSet<>(Arrays.asList(3, 2, 5))
396
-                        );
280
+        CustomSet<String> actual = new CustomSet<String>(Collections.emptyList())
281
+                .getDifference(new CustomSet<>(Arrays.asList("3", "2", "5")));
397 282
 
398 283
         assertNotNull(actual);
399 284
         assertTrue(actual.isEmpty());
@@ -402,15 +287,9 @@ public class CustomSetTest {
402 287
     @Ignore("Remove to run test")
403 288
     @Test
404 289
     public void differenceOfANonEmptySetAndAnEmptySetIsTheNonEmptySet() {
405
-        final CustomSet<Integer> expected
406
-                = new CustomSet<>(
407
-                        Collections.unmodifiableList(Arrays.asList(1, 2, 3, 4))
408
-                );
409
-        final CustomSet<Integer> actual
410
-                = new CustomSet<>(Arrays.asList(1, 2, 3, 4))
411
-                        .getDifference(
412
-                                new CustomSet<>(Collections.emptyList())
413
-                        );
290
+        CustomSet<Integer> expected = new CustomSet<>(Collections.unmodifiableList(Arrays.asList(1, 2, 3, 4)));
291
+        CustomSet<Integer> actual = new CustomSet<>(Arrays.asList(1, 2, 3, 4))
292
+                .getDifference(new CustomSet<>(Collections.emptyList()));
414 293
 
415 294
         assertNotNull(actual);
416 295
         assertFalse(actual.isEmpty());
@@ -420,15 +299,9 @@ public class CustomSetTest {
420 299
     @Ignore("Remove to run test")
421 300
     @Test
422 301
     public void differenceOfTwoNonEmptySetsIsASetOfElementsThatAreOnlyInTheFirstSet() {
423
-        final CustomSet<Integer> expected
424
-                = new CustomSet<>(
425
-                        Collections.unmodifiableList(Arrays.asList(1, 3))
426
-                );
427
-        final CustomSet<Integer> actual
428
-                = new CustomSet<>(Arrays.asList(3, 2, 1))
429
-                        .getDifference(
430
-                                new CustomSet<>(Arrays.asList(2, 4))
431
-                        );
302
+        CustomSet<Integer> expected = new CustomSet<>(Collections.unmodifiableList(Arrays.asList(1, 3)));
303
+        CustomSet<Integer> actual = new CustomSet<>(Arrays.asList(3, 2, 1))
304
+                .getDifference(new CustomSet<>(Arrays.asList(2, 4)));
432 305
 
433 306
         assertNotNull(actual);
434 307
         assertFalse(actual.isEmpty());
@@ -438,11 +311,8 @@ public class CustomSetTest {
438 311
     @Ignore("Remove to run test")
439 312
     @Test
440 313
     public void unionOfTwoEmptySetsIsAnEmptySet() {
441
-        final CustomSet<Integer> actual
442
-                = new CustomSet<Integer>(Collections.emptyList())
443
-                        .getUnion(
444
-                                new CustomSet<>(Collections.emptyList())
445
-                        );
314
+        CustomSet<Integer> actual = new CustomSet<Integer>(Collections.emptyList())
315
+                .getUnion(new CustomSet<>(Collections.emptyList()));
446 316
 
447 317
         assertNotNull(actual);
448 318
         assertTrue(actual.isEmpty());
@@ -451,15 +321,9 @@ public class CustomSetTest {
451 321
     @Ignore("Remove to run test")
452 322
     @Test
453 323
     public void unionOfAnEmptySetAndNonEmptySetIsTheNonEmptySet() {
454
-        final CustomSet<Integer> expected
455
-                = new CustomSet<>(
456
-                        Collections.unmodifiableList(Collections.singletonList(2))
457
-                );
458
-        final CustomSet<Integer> actual
459
-                = new CustomSet<Integer>(Collections.emptyList())
460
-                        .getUnion(
461
-                                new CustomSet<>(Collections.singletonList(2))
462
-                        );
324
+        CustomSet<Integer> expected = new CustomSet<>(Collections.unmodifiableList(Collections.singletonList(2)));
325
+        CustomSet<Integer> actual = new CustomSet<Integer>(Collections.emptyList())
326
+                .getUnion(new CustomSet<>(Collections.singletonList(2)));
463 327
 
464 328
         assertNotNull(actual);
465 329
         assertFalse(actual.isEmpty());
@@ -469,15 +333,9 @@ public class CustomSetTest {
469 333
     @Ignore("Remove to run test")
470 334
     @Test
471 335
     public void unionOfANonEmptySetAndAnEmptySetIsTheNonEmptySet() {
472
-        final CustomSet<Integer> expected
473
-                = new CustomSet<>(
474
-                        Collections.unmodifiableList(Arrays.asList(1, 3))
475
-                );
476
-        final CustomSet<Integer> actual
477
-                = new CustomSet<>(Arrays.asList(1, 3))
478
-                        .getUnion(
479
-                                new CustomSet<>(Collections.emptyList())
480
-                        );
336
+        CustomSet<Integer> expected = new CustomSet<>(Collections.unmodifiableList(Arrays.asList(1, 3)));
337
+        CustomSet<Integer> actual = new CustomSet<>(Arrays.asList(1, 3))
338
+                .getUnion(new CustomSet<>(Collections.emptyList()));
481 339
 
482 340
         assertNotNull(actual);
483 341
         assertFalse(actual.isEmpty());
@@ -487,15 +345,9 @@ public class CustomSetTest {
487 345
     @Ignore("Remove to run test")
488 346
     @Test
489 347
     public void unionOfTwoNonEmptySetsContainsAllUniqueElements() {
490
-        final CustomSet<Integer> expected
491
-                = new CustomSet<>(
492
-                        Collections.unmodifiableList(Arrays.asList(3, 2, 1))
493
-                );
494
-        final CustomSet<Integer> actual
495
-                = new CustomSet<>(Arrays.asList(1, 3))
496
-                        .getUnion(
497
-                                new CustomSet<>(Arrays.asList(2, 3))
498
-                        );
348
+        CustomSet<Character> expected = new CustomSet<>(Collections.unmodifiableList(Arrays.asList('3', '2', '1')));
349
+        CustomSet<Character> actual = new CustomSet<>(Arrays.asList('1', '3'))
350
+                .getUnion(new CustomSet<>(Arrays.asList('2', '3')));
499 351
 
500 352
         assertNotNull(actual);
501 353
         assertFalse(actual.isEmpty());