ResourceFileManager { public static Set<String> getResourceFolders(String path) { Set<String> resources = getResourcePaths(path); Set<String> result = new HashSet<>(); for (String r : resources) { String parent = new File(r).getParent(); result.add(parent); } return result; }  static Set<String> getResourcePaths(String path); static Set<String> getResourceFolders(String path); static boolean resourceExists(String location); static Set<String> getMatchingResources(String location);  }
@Test void canGetAllImmediateFoldersInResourcePackage() { String sep = File.separator; Set<String> set = ResourceFileManager.getResourceFolders("data/biboule/images"); assert (set.iterator().next().equals(String.format("data%1$sbiboule%1$simages", sep))); set = ResourceFileManager.getResourceFolders("data/common/default/images"); assert (set.iterator().next().equals(String.format("data%1$scommon%1$sdefault%1$simages", sep))); set = ResourceFileManager.getResourceFolders("data"); assert (set.contains(String.format("data%1$scommon%1$sdefault%1$simages", sep))); assert (set.contains(String.format("data%1$sbiboule%1$simages", sep))); }