Просмотр исходного кода

Use Collections.singletonList in custom-set tests

Zach Waltman 9 лет назад
Родитель
Сommit
12c0e4707d
1 измененных файлов: 8 добавлений и 8 удалений
  1. 8
    8
      exercises/custom-set/src/test/java/CustomSetTest.java

+ 8
- 8
exercises/custom-set/src/test/java/CustomSetTest.java Просмотреть файл

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