FsHandle implements Closeable { public List<FileListlet> list() throws IOException { if (refListing == null) { try (Stream<Path> paths = Files.list(ref)) { refListing = paths.map(this::buildNewListlet).collect(Collectors.toList()); } } return refListing; } 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 lists directory contents") void list_1(@TempDir Path temp) throws IOException { Files.createDirectory(temp.resolve("test1")); Files.createFile(temp.resolve("small_file.txt")); try (FsHandle fs = new FsHandle(temp.toString())) { assertTrue(fs.list().stream().anyMatch(listlet -> { return "test1".equals(listlet.getName()) && listlet.getDirectory() == true; })); assertTrue(fs.list().stream().anyMatch(listlet -> { return "small_file.txt".equals(listlet.getName()) && listlet.getDirectory() == false; })); assertEquals(2, fs.list().size()); } }