ResourceLocator implements Locator<ResourceLocation> { @Override public File copyToDirectory(ResourceLocation location, File toDir) { return copyToFile(location, new File(toDir, location.getFilename())); }  @Override File locate(ResourceLocation location); @Override File copyToDirectory(ResourceLocation location, File toDir); @Override InputStream openInputStream(ResourceLocation location); @Override File copyToFile(ResourceLocation location, File toFile);  }
@Test public void copyToDirectory() throws Exception { File toDir = temp.newFolder(); ResourceLocation location = ResourceLocation.create("/com/sonar/orchestrator/locator/ResourceLocatorTest/foo.txt"); File copy = resourceLocator.copyToDirectory(location, toDir); assertThat(copy).exists().isFile(); assertThat(copy.getName()).isEqualTo("foo.txt"); assertThat(FileUtils.readFileToString(copy)).isEqualTo("foo"); }