ScssFrameworkInstaller { protected File getAndCheckUnpackedSourceFolder(final String gemName, final File folder) throws Exception { final File[] unpackedFiles = folder.listFiles(); if (unpackedFiles == null || unpackedFiles.length == 0) { this.logger.error("No files in folder " + folder.getAbsolutePath()); throw new Exception("A problem occured while retrieving " + gemName + " sources files"); } if (unpackedFiles.length != 1) { this.logger.error("Folder " + folder.getAbsolutePath() + "should contains only one folder. Folder content :"); Arrays.stream(unpackedFiles).map(File::getName) .forEach(this.logger::error); throw new Exception("A problem occured while retrieving " + gemName + " sources files"); } return unpackedFiles[0]; } ScssFrameworkInstaller(final Logger logger); void installFramework(
            final FrameworkPropertiesEnum frameworkProperties); void setVersionToDownload(final String versionToDownload); void setInstallationPath(final Path installationPath);  }
@Test(expected = Exception.class) public void getAndCheckUnpackedSourceFolder_No_Folder() throws Exception { final File source = this.folder.getRoot(); final ScssFrameworkInstaller installer = new ScssFrameworkInstaller( this.logger); installer.getAndCheckUnpackedSourceFolder("test", source); }
@Test(expected = Exception.class) public void getAndCheckUnpackedSourceFolder_Many_Folders() throws Exception { final File source = this.folder.getRoot(); this.folder.newFolder(); this.folder.newFolder(); final ScssFrameworkInstaller installer = new ScssFrameworkInstaller( this.logger); installer.getAndCheckUnpackedSourceFolder("test", source); }
@Test public void getAndCheckUnpackedSourceFolder_One_Folder() throws Exception { final File source = this.folder.getRoot(); final File unpackedFolder = this.folder.newFolder(); final ScssFrameworkInstaller installer = new ScssFrameworkInstaller( this.logger); final File unpackedSourceFolder = installer .getAndCheckUnpackedSourceFolder("test", source); Assert.assertEquals(unpackedSourceFolder, unpackedFolder); Mockito.verify(this.logger, Mockito.never()).error(Mockito.anyString()); }