@@ -13,31 +13,35 @@ public class ListOpsTest {
1313 public void testAppendingEmptyLists () {
1414 assertEquals (
1515 Collections .emptyList (),
16- ListOps .append (Collections .emptyList (), Collections .emptyList ()));
16+ ListOps .append (Collections .emptyList (), Collections .emptyList ())
17+ );
1718 }
1819
1920 @ Ignore ("Remove to run test" )
2021 @ Test
2122 public void testAppendingNonEmptyListOnEmptyList () {
2223 assertEquals (
2324 Arrays .asList ('1' , '2' , '3' , '4' ),
24- ListOps .append (Collections .emptyList (), Arrays .asList ('1' , '2' , '3' , '4' )));
25+ ListOps .append (Collections .emptyList (), Arrays .asList ('1' , '2' , '3' , '4' ))
26+ );
2527 }
2628
2729 @ Ignore ("Remove to run test" )
2830 @ Test
2931 public void testAppendingNonEmptyListOnNonEmptyList () {
3032 assertEquals (
3133 Arrays .asList ("1" , "2" , "2" , "3" , "4" , "5" ),
32- ListOps .append (Arrays .asList ("1" , "2" ), Arrays .asList ("2" , "3" , "4" , "5" )));
34+ ListOps .append (Arrays .asList ("1" , "2" ), Arrays .asList ("2" , "3" , "4" , "5" ))
35+ );
3336 }
3437
3538 @ Ignore ("Remove to run test" )
3639 @ Test
3740 public void testConcatOnEmptyListOfLists () {
3841 assertEquals (
3942 Collections .emptyList (),
40- ListOps .concat (Collections .emptyList ()));
43+ ListOps .concat (Collections .emptyList ())
44+ );
4145 }
4246
4347 @ Ignore ("Remove to run test" )
@@ -47,11 +51,13 @@ public void testConcatOnNonEmptyListOfLists() {
4751 Arrays .asList ('1' , '2' ),
4852 Collections .singletonList ('3' ),
4953 Collections .emptyList (),
50- Arrays .asList ('4' , '5' , '6' ));
54+ Arrays .asList ('4' , '5' , '6' )
55+ );
5156
5257 assertEquals (
5358 Arrays .asList ('1' , '2' , '3' , '4' , '5' , '6' ),
54- ListOps .concat (listOfLists ));
59+ ListOps .concat (listOfLists )
60+ );
5561 }
5662
5763 @ Ignore ("Remove to run test" )
@@ -90,15 +96,17 @@ public void testConcatOnNonEmptyListOfNestedLists() {
9096 public void testFilteringEmptyList () {
9197 assertEquals (
9298 Collections .emptyList (),
93- ListOps .filter (Collections .<Integer >emptyList (), integer -> integer % 2 == 1 ));
99+ ListOps .filter (Collections .<Integer >emptyList (), integer -> integer % 2 == 1 )
100+ );
94101 }
95102
96103 @ Ignore ("Remove to run test" )
97104 @ Test
98105 public void testFilteringNonEmptyList () {
99106 assertEquals (
100107 Arrays .asList (1 , 3 , 5 ),
101- ListOps .filter (Arrays .asList (1 , 2 , 3 , 5 ), integer -> integer % 2 == 1 ));
108+ ListOps .filter (Arrays .asList (1 , 2 , 3 , 5 ), integer -> integer % 2 == 1 )
109+ );
102110 }
103111
104112 @ Ignore ("Remove to run test" )
@@ -118,15 +126,17 @@ public void testSizeOfNonEmptyList() {
118126 public void testTransformingEmptyList () {
119127 assertEquals (
120128 Collections .emptyList (),
121- ListOps .map (Collections .<Integer >emptyList (), integer -> integer + 1 ));
129+ ListOps .map (Collections .<Integer >emptyList (), integer -> integer + 1 )
130+ );
122131 }
123132
124133 @ Ignore ("Remove to run test" )
125134 @ Test
126135 public void testTransformingNonEmptyList () {
127136 assertEquals (
128137 Arrays .asList (2 , 4 , 6 , 8 ),
129- ListOps .map (Arrays .asList (1 , 3 , 5 , 7 ), integer -> integer + 1 ));
138+ ListOps .map (Arrays .asList (1 , 3 , 5 , 7 ), integer -> integer + 1 )
139+ );
130140 }
131141
132142 @ Ignore ("Remove to run test" )
@@ -137,7 +147,9 @@ public void testFoldLeftOnEmptyList() {
137147 ListOps .foldLeft (
138148 Collections .<Double >emptyList (),
139149 2.0 ,
140- (x , y ) -> x * y ));
150+ (x , y ) -> x * y
151+ )
152+ );
141153 }
142154
143155 @ Ignore ("Remove to run test" )
@@ -148,7 +160,9 @@ public void testFoldLeftWithDirectionIndependentOperationOnNonEmptyList() {
148160 ListOps .foldLeft (
149161 Arrays .asList (1 , 2 , 3 , 4 ),
150162 5 ,
151- (x , y ) -> x + y ));
163+ (x , y ) -> x + y
164+ )
165+ );
152166 }
153167
154168 @ Ignore ("Remove to run test" )
@@ -159,7 +173,9 @@ public void testFoldLeftWithDirectionDependentOperationOnNonEmptyList() {
159173 ListOps .foldLeft (
160174 Arrays .asList (2 , 5 ),
161175 5 ,
162- (x , y ) -> x / y ));
176+ (x , y ) -> x / y
177+ )
178+ );
163179 }
164180
165181 @ Ignore ("Remove to run test" )
@@ -170,7 +186,9 @@ public void testFoldRightOnEmptyList() {
170186 ListOps .foldRight (
171187 Collections .<Double >emptyList (),
172188 2.0 ,
173- (x , y ) -> x * y ));
189+ (x , y ) -> x * y
190+ )
191+ );
174192 }
175193
176194 @ Ignore ("Remove to run test" )
@@ -181,7 +199,9 @@ public void testFoldRightWithDirectionIndependentOperationOnNonEmptyList() {
181199 ListOps .foldRight (
182200 Arrays .asList (1 , 2 , 3 , 4 ),
183201 5 ,
184- (x , y ) -> x + y ));
202+ (x , y ) -> x + y
203+ )
204+ );
185205 }
186206
187207 @ Ignore ("Remove to run test" )
@@ -192,23 +212,48 @@ public void testFoldRightWithDirectionDependentOperationOnNonEmptyList() {
192212 ListOps .foldRight (
193213 Arrays .asList (2 , 5 ),
194214 5 ,
195- (x , y ) -> x / y ));
215+ (x , y ) -> x / y
216+ )
217+ );
196218 }
197219
198220 @ Ignore ("Remove to run test" )
199221 @ Test
200222 public void testReversingEmptyList () {
201223 assertEquals (
202224 Collections .emptyList (),
203- ListOps .reverse (Collections .emptyList ()));
225+ ListOps .reverse (Collections .emptyList ())
226+ );
204227 }
205228
206229 @ Ignore ("Remove to run test" )
207230 @ Test
208231 public void testReversingNonEmptyList () {
209232 assertEquals (
210233 Arrays .asList ('7' , '5' , '3' , '1' ),
211- ListOps .reverse (Arrays .asList ('1' , '3' , '5' , '7' )));
234+ ListOps .reverse (Arrays .asList ('1' , '3' , '5' , '7' ))
235+ );
236+ }
237+
238+ @ Ignore ("Remove to run test" )
239+ @ Test
240+ public void testListOfListIsNotFlattened () {
241+ List <List <Character >> listOfLists = Arrays .asList (
242+ Arrays .asList ('1' , '2' ),
243+ Collections .singletonList ('3' ),
244+ Collections .emptyList (),
245+ Arrays .asList ('4' , '5' , '6' )
246+ );
247+
248+ assertEquals (
249+ Arrays .asList (
250+ Arrays .asList ('4' , '5' , '6' ),
251+ Collections .emptyList (),
252+ Collections .singletonList ('3' ),
253+ Arrays .asList ('1' , '2' )
254+ ),
255+ ListOps .reverse (listOfLists )
256+ );
212257 }
213258
214259}
0 commit comments