Преглед на файлове

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 години
родител
ревизия
06655c3751
променени са 2 файла, в които са добавени 33 реда и са изтрити 2 реда
  1. 1
    1
      exercises/list-ops/.meta/version
  2. 32
    1
      exercises/list-ops/src/test/java/ListOpsTest.java

+ 1
- 1
exercises/list-ops/.meta/version Целия файл

@@ -1 +1 @@
1
-2.2.0
1
+2.3.0

+ 32
- 1
exercises/list-ops/src/test/java/ListOpsTest.java Целия файл

@@ -56,6 +56,37 @@ public class ListOpsTest {
56 56
 
57 57
     @Ignore("Remove to run test")
58 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 90
     public void testFilteringEmptyList() {
60 91
         assertEquals(
61 92
                 Collections.emptyList(),
@@ -179,5 +210,5 @@ public class ListOpsTest {
179 210
                 Arrays.asList('7', '5', '3', '1'),
180 211
                 ListOps.reverse(Arrays.asList('1', '3', '5', '7')));
181 212
     }
182
-    
213
+
183 214
 }