Browse Source

Use Collections.singletonList in custom-set tests

Zach Waltman 9 years ago
parent
commit
12c0e4707d
1 changed files with 8 additions and 8 deletions
  1. 8
    8
      exercises/custom-set/src/test/java/CustomSetTest.java

+ 8
- 8
exercises/custom-set/src/test/java/CustomSetTest.java View File

@@ -21,7 +21,7 @@ public class CustomSetTest {
21 21
     @Test
22 22
     public void setsWithElementsAreNotEmpty() {
23 23
         final boolean actual
24
-                = new CustomSet<>(Arrays.asList(1))
24
+                = new CustomSet<>(Collections.singletonList(1))
25 25
                         .isEmpty();
26 26
 
27 27
         assertFalse(actual);
@@ -73,7 +73,7 @@ public class CustomSetTest {
73 73
     @Test
74 74
     public void emptySetIsASubsetOfNonEmptySet() {
75 75
         final boolean actual
76
-                = new CustomSet<>(Arrays.asList(1))
76
+                = new CustomSet<>(Collections.singletonList(1))
77 77
                         .isSubset(
78 78
                                 new CustomSet<>(Collections.EMPTY_LIST)
79 79
                         );
@@ -87,7 +87,7 @@ public class CustomSetTest {
87 87
         final boolean actual
88 88
                 = new CustomSet<>(Collections.EMPTY_LIST)
89 89
                         .isSubset(
90
-                                new CustomSet<>(Arrays.asList(1))
90
+                                new CustomSet<>(Collections.singletonList(1))
91 91
                         );
92 92
 
93 93
         assertFalse(actual);
@@ -147,7 +147,7 @@ public class CustomSetTest {
147 147
         final boolean actual
148 148
                 = new CustomSet<>(Collections.EMPTY_LIST)
149 149
                         .isDisjoint(
150
-                                new CustomSet<>(Arrays.asList(1))
150
+                                new CustomSet<>(Collections.singletonList(1))
151 151
                         );
152 152
 
153 153
         assertTrue(actual);
@@ -157,7 +157,7 @@ public class CustomSetTest {
157 157
     @Test
158 158
     public void nonEmptySetIsDisjointWithEmptySet() {
159 159
         final boolean actual
160
-                = new CustomSet<>(Arrays.asList(1))
160
+                = new CustomSet<>(Collections.singletonList(1))
161 161
                         .isDisjoint(
162 162
                                 new CustomSet<>(Collections.EMPTY_LIST)
163 163
                         );
@@ -255,7 +255,7 @@ public class CustomSetTest {
255 255
         final int element = 3;
256 256
         final CustomSet<Integer> expected
257 257
                 = new CustomSet<>(
258
-                        Collections.unmodifiableList(Arrays.asList(element))
258
+                        Collections.unmodifiableList(Collections.singletonList(element))
259 259
                 );
260 260
         final CustomSet<Integer> actual
261 261
                 = new CustomSet<>(Collections.EMPTY_LIST);
@@ -453,12 +453,12 @@ public class CustomSetTest {
453 453
     public void unionOfAnEmptySetAndNonEmptySetIsTheNonEmptySet() {
454 454
         final CustomSet<Integer> expected
455 455
                 = new CustomSet<>(
456
-                        Collections.unmodifiableList(Arrays.asList(2))
456
+                        Collections.unmodifiableList(Collections.singletonList(2))
457 457
                 );
458 458
         final CustomSet<Integer> actual
459 459
                 = new CustomSet<>(Collections.EMPTY_LIST)
460 460
                         .getUnion(
461
-                                new CustomSet<>(Arrays.asList(2))
461
+                                new CustomSet<>(Collections.singletonList(2))
462 462
                         );
463 463
 
464 464
         assertNotNull(actual);