30
30
31
31
import org .assertj .core .api .Condition ;
32
32
import org .awaitility .Awaitility ;
33
- import org .codehaus .plexus .util .CollectionUtils ;
34
33
import org .junit .jupiter .api .AfterEach ;
35
34
import org .junit .jupiter .api .BeforeEach ;
36
35
import org .junit .jupiter .api .Test ;
@@ -140,7 +139,8 @@ void testUserSpecifiedSlashPath() throws Exception {
140
139
System .setProperty ("loader.path" , "jars/" );
141
140
PropertiesLauncher launcher = new PropertiesLauncher ();
142
141
assertThat (ReflectionTestUtils .getField (launcher , "paths" ).toString ()).isEqualTo ("[jars/]" );
143
- List <Archive > archives = CollectionUtils .iteratorToList (launcher .getClassPathArchivesIterator ());
142
+ List <Archive > archives = new ArrayList <>();
143
+ launcher .getClassPathArchivesIterator ().forEachRemaining (archives ::add );
144
144
assertThat (archives ).areExactly (1 , endingWith ("app.jar" ));
145
145
}
146
146
@@ -170,7 +170,8 @@ void testUserSpecifiedRootOfJarPath() throws Exception {
170
170
PropertiesLauncher launcher = new PropertiesLauncher ();
171
171
assertThat (ReflectionTestUtils .getField (launcher , "paths" ).toString ())
172
172
.isEqualTo ("[jar:file:./src/test/resources/nested-jars/app.jar!/]" );
173
- List <Archive > archives = CollectionUtils .iteratorToList (launcher .getClassPathArchivesIterator ());
173
+ List <Archive > archives = new ArrayList <>();
174
+ launcher .getClassPathArchivesIterator ().forEachRemaining (archives ::add );
174
175
assertThat (archives ).areExactly (1 , endingWith ("foo.jar!/" ));
175
176
assertThat (archives ).areExactly (1 , endingWith ("app.jar" ));
176
177
}
@@ -179,7 +180,8 @@ void testUserSpecifiedRootOfJarPath() throws Exception {
179
180
void testUserSpecifiedRootOfJarPathWithDot () throws Exception {
180
181
System .setProperty ("loader.path" , "nested-jars/app.jar!/./" );
181
182
PropertiesLauncher launcher = new PropertiesLauncher ();
182
- List <Archive > archives = CollectionUtils .iteratorToList (launcher .getClassPathArchivesIterator ());
183
+ List <Archive > archives = new ArrayList <>();
184
+ launcher .getClassPathArchivesIterator ().forEachRemaining (archives ::add );
183
185
assertThat (archives ).areExactly (1 , endingWith ("foo.jar!/" ));
184
186
assertThat (archives ).areExactly (1 , endingWith ("app.jar" ));
185
187
}
@@ -188,7 +190,8 @@ void testUserSpecifiedRootOfJarPathWithDot() throws Exception {
188
190
void testUserSpecifiedRootOfJarPathWithDotAndJarPrefix () throws Exception {
189
191
System .setProperty ("loader.path" , "jar:file:./src/test/resources/nested-jars/app.jar!/./" );
190
192
PropertiesLauncher launcher = new PropertiesLauncher ();
191
- List <Archive > archives = CollectionUtils .iteratorToList (launcher .getClassPathArchivesIterator ());
193
+ List <Archive > archives = new ArrayList <>();
194
+ launcher .getClassPathArchivesIterator ().forEachRemaining (archives ::add );
192
195
assertThat (archives ).areExactly (1 , endingWith ("foo.jar!/" ));
193
196
}
194
197
@@ -197,7 +200,8 @@ void testUserSpecifiedJarFileWithNestedArchives() throws Exception {
197
200
System .setProperty ("loader.path" , "nested-jars/app.jar" );
198
201
System .setProperty ("loader.main" , "demo.Application" );
199
202
PropertiesLauncher launcher = new PropertiesLauncher ();
200
- List <Archive > archives = CollectionUtils .iteratorToList (launcher .getClassPathArchivesIterator ());
203
+ List <Archive > archives = new ArrayList <>();
204
+ launcher .getClassPathArchivesIterator ().forEachRemaining (archives ::add );
201
205
assertThat (archives ).areExactly (1 , endingWith ("foo.jar!/" ));
202
206
assertThat (archives ).areExactly (1 , endingWith ("app.jar" ));
203
207
}
@@ -207,7 +211,8 @@ void testUserSpecifiedNestedJarPath() throws Exception {
207
211
System .setProperty ("loader.path" , "nested-jars/app.jar!/foo.jar" );
208
212
System .setProperty ("loader.main" , "demo.Application" );
209
213
PropertiesLauncher launcher = new PropertiesLauncher ();
210
- List <Archive > archives = CollectionUtils .iteratorToList (launcher .getClassPathArchivesIterator ());
214
+ List <Archive > archives = new ArrayList <>();
215
+ launcher .getClassPathArchivesIterator ().forEachRemaining (archives ::add );
211
216
assertThat (archives ).hasSize (1 ).areExactly (1 , endingWith ("foo.jar!/" ));
212
217
}
213
218
@@ -336,7 +341,8 @@ void encodedFileUrlLoaderPathIsHandledCorrectly() throws Exception {
336
341
loaderPath .mkdir ();
337
342
System .setProperty ("loader.path" , loaderPath .toURI ().toURL ().toString ());
338
343
PropertiesLauncher launcher = new PropertiesLauncher ();
339
- List <Archive > archives = CollectionUtils .iteratorToList (launcher .getClassPathArchivesIterator ());
344
+ List <Archive > archives = new ArrayList <>();
345
+ launcher .getClassPathArchivesIterator ().forEachRemaining (archives ::add );
340
346
assertThat (archives .size ()).isEqualTo (1 );
341
347
File archiveRoot = (File ) ReflectionTestUtils .getField (archives .get (0 ), "root" );
342
348
assertThat (archiveRoot ).isEqualTo (loaderPath );
0 commit comments