FsHandle implements Closeable { public boolean down(String directory) { if (directory == null) throw new IllegalArgumentException(); Path potential = ref.resolve(directory); if (Files.isDirectory(potential) && Files.exists(potential)) { movePath(potential); return true; } return false; } FsHandle();  FsHandle(String start);  FsHandle(String start, FsHandleOptions options);  FsHandle(FileSystem fs, String start, FsHandleOptions options); int getId(); String pwd(); void addUpdateCallback(Consumer<EV_FileListing> callback); boolean up(); boolean down(String directory); boolean setPath(String path); List<FileListlet> list(); @Override void close();  }
@Test @DisplayName("Check that the handle can descend into directories") void down_1(@TempDir Path temp) throws IOException { Files.createDirectories(temp.resolve("test1/test2/test3")); try (FsHandle fs = new FsHandle(temp.toString())) { assertTrue(fs.down("test1")); assertTrue(fs.down("test2")); assertTrue(fs.down("test3")); } }
@Test @DisplayName("Check that the handle cannot descend into files") void down_2(@TempDir Path temp) throws IOException { Files.createFile(temp.resolve("test.txt")); try (FsHandle fs = new FsHandle(temp.toString())) { assertFalse(fs.down("test.txt")); } }