ScssFrameworkInstaller { protected void copySourcesToInstallationPath(final File sourcesFolder, final Path installationPath) throws IOException { final File[] listFiles = sourcesFolder.listFiles(); if (listFiles == null || listFiles.length == 0) { this.logger.error( "No files in folder " + sourcesFolder.getAbsolutePath()); return; } for (final File source : listFiles) { if (source.isDirectory()) { FileUtils.copyDirectory(source, installationPath.resolve(source.getName()).toFile()); this.logger.info("Folder " + source.getName() + " copied"); } else { FileUtils.copyFile(source, installationPath.resolve(source.getName()).toFile()); this.logger.info("File " + source.getName() + " copied"); } } } ScssFrameworkInstaller(final Logger logger); void installFramework(
            final FrameworkPropertiesEnum frameworkProperties); void setVersionToDownload(final String versionToDownload); void setInstallationPath(final Path installationPath);  }
@Test public void copySourcesToInstallationPath_No_Files() throws IOException { final ScssFrameworkInstaller installer = new ScssFrameworkInstaller( this.logger); installer.copySourcesToInstallationPath(this.folder.getRoot(), null); Mockito.verify(this.logger, Mockito.times(1)) .error(Mockito.anyString()); }
@Test public void copySourcesToInstallationPath() throws IOException { this.folder.newFolder(); this.folder.newFile(); final ScssFrameworkInstaller installer = new ScssFrameworkInstaller( this.logger); final File root = this.folder.getRoot(); final Path installationPath = Paths.get(root.getAbsolutePath(), "install"); installer.copySourcesToInstallationPath(root, installationPath); Mockito.verify(this.logger, Mockito.times(2)).info(Mockito.anyString()); final File installationFolder = installationPath.toFile(); final File[] listFiles = installationFolder.listFiles(); Assert.assertNotNull(listFiles); Assert.assertEquals(listFiles.length, 2); Assert.assertEquals( Arrays.stream(listFiles).filter(File::isFile).count(), 1); Assert.assertEquals( Arrays.stream(listFiles).filter(File::isDirectory).count(), 1); }