private void setupDefaultAssetFolder() { String assetFolder = getAsString(JBakeProperty.ASSET_FOLDER); setAssetFolder(new File(getSourceFolder(), assetFolder)); }
private void setupDefaultDestination() { String destinationPath = getAsString(JBakeProperty.DESTINATION_FOLDER); setDestinationFolder(new File(getSourceFolder(), destinationPath)); }
private void setupDefaultTemplateFolder() { String destinationPath = getAsString(JBakeProperty.TEMPLATE_FOLDER); setTemplateFolder(new File(getSourceFolder(), destinationPath)); }
private void setupDefaultContentFolder() { setContentFolder(new File(getSourceFolder(), getContentFolderName())); }
@Test public void testCopyCustomFolder() throws Exception { config.setAssetFolder(new File(config.getSourceFolder(), "/media")); Asset asset = new Asset(config); asset.copy(); File favFile = new File(folder.toString() + File.separatorChar + "favicon.ico"); Assertions.assertTrue(favFile.exists(), () -> "File " + favFile.getAbsolutePath() + " does not exist"); Assertions.assertTrue(asset.getErrors().isEmpty(), "Errors during asset copying"); }
/** * Primary intention is to extend test cases to increase coverage. * * @throws Exception */ @Test public void testUnlistable() throws Exception { config.setAssetFolder(new File(config.getSourceFolder(), "non-exsitent")); Asset asset = new Asset(config); asset.copy(); }
/** * Primary intention is to extend test cases to increase coverage. * * @throws Exception */ @Test public void testWriteProtected() throws Exception { File assets = new File(config.getSourceFolder(), "assets"); File css = new File(folder.toFile(),"css"); css.mkdir(); final File cssFile = new File(css, "bootstrap.min.css"); FileUtils.touch(cssFile); cssFile.setReadOnly(); config.setAssetFolder(assets); config.setDestinationFolder(folder.toFile()); Asset asset = new Asset(config); asset.copy(); cssFile.setWritable(true); Assertions.assertFalse(asset.getErrors().isEmpty(), "At least one error during copy expected"); }
private void setupDefaultDestination() { String destinationPath = getAsString(JBakeProperty.DESTINATION_FOLDER); setDestinationFolder(new File(getSourceFolder(), destinationPath)); }
private void setupDefaultAssetFolder() { String assetFolder = getAsString(JBakeProperty.ASSET_FOLDER); setAssetFolder(new File(getSourceFolder(), assetFolder)); }
private void setupDefaultTemplateFolder() { String destinationPath = getAsString(JBakeProperty.TEMPLATE_FOLDER); setTemplateFolder(new File(getSourceFolder(), destinationPath)); }
private void setupDefaultContentFolder() { setContentFolder(new File(getSourceFolder(), getContentFolderName())); }