FileSystemUtils { static long countSubDirectories(Path path) { try (Stream<Path> stream = Files.walk(path)) { return stream.skip(1).filter(Files::isDirectory).count(); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } } private  FileSystemUtils(); static String toId(FolderPath folderPath); static FolderPath fromId(String id);  }
@Test public void countSubDirectories() throws Exception { assertEquals(3, FileSystemUtils.countSubDirectories(testFolder)); }