File tree Expand file tree Collapse file tree
src/test/java/org/apache/commons/io/file Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020import static org .junit .jupiter .api .Assertions .assertArrayEquals ;
2121import static org .junit .jupiter .api .Assertions .assertEquals ;
2222import static org .junit .jupiter .api .Assertions .assertFalse ;
23+ import static org .junit .jupiter .api .Assertions .assertNull ;
2324import static org .junit .jupiter .api .Assertions .assertThrowsExactly ;
2425import static org .junit .jupiter .api .Assertions .assertTrue ;
2526import static org .junit .jupiter .api .Assumptions .assumeFalse ;
@@ -176,11 +177,13 @@ public void testCreateDirectoriesAlreadyExists() throws IOException {
176177 assertEquals (tempDirPath .getParent (), PathUtils .createParentDirectories (tempDirPath ));
177178 }
178179
180+ @ SuppressWarnings ("resource" ) // FileSystems.getDefault() is a singleton
179181 @ Test
180182 public void testCreateDirectoriesForRoots () throws IOException {
181- for (final File f : File .listRoots ()) {
182- final Path path = f .toPath ();
183- assertEquals (path .getParent (), PathUtils .createParentDirectories (path ));
183+ for (final Path path : FileSystems .getDefault ().getRootDirectories ()) {
184+ final Path parent = path .getParent ();
185+ assertNull (parent );
186+ assertEquals (parent , PathUtils .createParentDirectories (path ));
184187 }
185188 }
186189
You can’t perform that action at this time.
0 commit comments