### Question:
FilesystemResourceLocator implements ResourceLocator { public Collection<Resource> findResources(String name) { Collection<Resource> resources = new ArrayList<>(3); for (File root : roots) { File resourceFile = new File(root, name); if (resourceFile.exists()) { try { resources.add(new URLResource(resourceFile.toURI().toURL())); } catch (MalformedURLException e) { throw new CayenneRuntimeException( "Can't convert file to URL: %s", e, resourceFile.getAbsolutePath()); } } } return resources; } FilesystemResourceLocator(File... roots);  FilesystemResourceLocator(Collection<File> roots); Collection<Resource> findResources(String name);  }### Answer:
@Test public void testFindResources() throws Exception { File base = new File(FileUtil.baseTestDirectory(), getClass().getName()); File root1 = new File(base, "r1"); File root2 = new File(base, "r2"); root1.mkdirs(); root2.mkdirs(); FilesystemResourceLocator locator = new FilesystemResourceLocator(root1, root2); Collection<Resource> resources1 = locator.findResources("x.txt"); assertNotNull(resources1); assertEquals(0, resources1.size()); File f1 = new File(root1, "x.txt"); touch(f1); Collection<Resource> resources2 = locator.findResources("x.txt"); assertNotNull(resources2); assertEquals(1, resources2.size()); assertEquals(f1.toURI().toURL(), resources2.iterator().next().getURL()); File f2 = new File(root2, "x.txt"); touch(f2); Collection<Resource> resources3 = locator.findResources("x.txt"); assertNotNull(resources3); assertEquals(2, resources3.size()); Resource[] resources3a = resources3.toArray(new Resource[2]); assertEquals(f1.toURI().toURL(), resources3a[0].getURL()); assertEquals(f2.toURI().toURL(), resources3a[1].getURL()); }