FileSystemUtils { static boolean hasEntry(Path path) { boolean hasChild; try (Stream<Path> pathsStream = Files.walk(path)) { hasChild = pathsStream.filter(Files::isRegularFile).map(FileSystemUtils::toFolderEntry).findAny().isPresent(); } catch (IOException e) { throw new TDPException(UNABLE_TO_DELETE_FOLDER, e, build().put("path", path)); } return hasChild; } private  FileSystemUtils(); static String toId(FolderPath folderPath); static FolderPath fromId(String id);  }
@Test public void hasEntry_testFolderHasDirectChild() throws Exception { createEntry(testFolder.resolve("toto.dp"), "contentId", "folderId", FolderContentType.PREPARATION); assertTrue(FileSystemUtils.hasEntry(testFolder)); }
@Test public void hasEntry_testFolderHasInDirectChild() throws Exception { createEntry(testFolder.resolve("foo/toto.dp"), "contentId", "folderId", FolderContentType.PREPARATION); assertTrue(FileSystemUtils.hasEntry(testFolder)); }
@Test public void hasEntry_childFolderHasNoChild() throws Exception { assertFalse(FileSystemUtils.hasEntry(testFolder)); }