### Question:
FileOperations { public static void copy(ImmutableList<Path> sourceFiles, Path destDir) throws IOException { for (Path sourceFile : sourceFiles) { PathConsumer copyPathConsumer = path -> { Path destPath = destDir.resolve(sourceFile.getParent().relativize(path)); if (Files.isDirectory(path)) { Files.createDirectories(destPath); } else { Files.copy(path, destPath); } }; if (Files.isDirectory(sourceFile)) { new DirectoryWalker(sourceFile).walk(copyPathConsumer); } else { copyPathConsumer.accept(sourceFile); } } } private  FileOperations(); static void copy(ImmutableList<Path> sourceFiles, Path destDir); static OutputStream newLockingOutputStream(Path file);  }### Answer:
@Test public void testCopy() throws IOException, URISyntaxException { Path destDir = temporaryFolder.newFolder().toPath(); Path libraryA = Paths.get(Resources.getResource("core/application/dependencies/libraryA.jar").toURI()); Path libraryB = Paths.get(Resources.getResource("core/application/dependencies/libraryB.jar").toURI()); Path dirLayer = Paths.get(Resources.getResource("core/layer").toURI()); FileOperations.copy(ImmutableList.of(libraryA, libraryB, dirLayer), destDir); assertFilesEqual(libraryA, destDir.resolve("libraryA.jar")); assertFilesEqual(libraryB, destDir.resolve("libraryB.jar")); Assert.assertTrue(Files.exists(destDir.resolve("layer").resolve("a").resolve("b"))); Assert.assertTrue(Files.exists(destDir.resolve("layer").resolve("c"))); assertFilesEqual( dirLayer.resolve("a").resolve("b").resolve("bar"), destDir.resolve("layer").resolve("a").resolve("b").resolve("bar")); assertFilesEqual( dirLayer.resolve("c").resolve("cat"), destDir.resolve("layer").resolve("c").resolve("cat")); assertFilesEqual(dirLayer.resolve("foo"), destDir.resolve("layer").resolve("foo")); }