Browse Source

Add test to list of nested lists. (#1478)

* Update version file v2.2.0 --> v2.3.0

* Add new test for list of nested list.

* Add updated test

* Make changes to code and make it more readable

* Fix data set and indentation

* Fix indentation error

* Fix Bug
Ronak Lakhotia 6 years ago
parent
commit
06655c3751

+ 1
- 1
exercises/list-ops/.meta/version View File

1
-2.2.0
1
+2.3.0

+ 32
- 1
exercises/list-ops/src/test/java/ListOpsTest.java View File

56
 
56
 
57
     @Ignore("Remove to run test")
57
     @Ignore("Remove to run test")
58
     @Test
58
     @Test
59
+    public void testConcatOnNonEmptyListOfNestedLists() {
60
+        List<List<List<Character>>> listOfNestedLists = Arrays.asList(
61
+                Arrays.asList(
62
+                        Collections.singletonList('1'),
63
+                        Collections.singletonList('2')
64
+                ),
65
+                Collections.singletonList(
66
+                        Collections.singletonList('3')
67
+                ),
68
+                Collections.singletonList(
69
+                        Collections.emptyList()
70
+                ),
71
+                Collections.singletonList(
72
+                        Arrays.asList('4', '5', '6')
73
+                )
74
+        );
75
+
76
+        assertEquals(
77
+                Arrays.asList(
78
+                        Collections.singletonList('1'),
79
+                        Collections.singletonList('2'),
80
+                        Collections.singletonList('3'),
81
+                        Collections.emptyList(),
82
+                        Arrays.asList('4', '5', '6')
83
+                ),
84
+                ListOps.concat(listOfNestedLists)
85
+        );
86
+    }
87
+
88
+    @Ignore("Remove to run test")
89
+    @Test
59
     public void testFilteringEmptyList() {
90
     public void testFilteringEmptyList() {
60
         assertEquals(
91
         assertEquals(
61
                 Collections.emptyList(),
92
                 Collections.emptyList(),
179
                 Arrays.asList('7', '5', '3', '1'),
210
                 Arrays.asList('7', '5', '3', '1'),
180
                 ListOps.reverse(Arrays.asList('1', '3', '5', '7')));
211
                 ListOps.reverse(Arrays.asList('1', '3', '5', '7')));
181
     }
212
     }
182
-    
213
+
183
 }
214
 }