ResourceFileManager { public static Set<String> getResourcePaths(String path) { String packageName = path.replaceAll("[/\\\\]", "."); Reflections reflections = new Reflections(packageName, new ResourcesScanner()); return reflections.getResources(Pattern.compile(createExtensionRegex(ImageUtils.supportedFilesExtensions))); }  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 canGetAllFilesInResourcePackage() { Set<String> set = ResourceFileManager.getResourcePaths("data/biboule/images"); assert (set.size() == 1); set = ResourceFileManager.getResourcePaths("data/common/default/images"); assert (set.size() == 2); set = ResourceFileManager.getResourcePaths("data"); assert (set.size() == 3); }
@Test void canGetAllFilesInResourcePackageWithBackslashes() { Set<String> set = ResourceFileManager.getResourcePaths("data\\biboule\\images"); assert (set.size() == 1); set = ResourceFileManager.getResourcePaths("data\\biboule"); assert (set.size() == 1); }
@Test void canLoadAnImageFromResources() { Set<String> set = ResourceFileManager.getResourcePaths("data/biboule/images"); Image image = new Image(set.iterator().next()); assert (!image.getUrl().equals("")); }