### Question:
CompiledJavaccFile { public void copyCompiledFileToTargetDirectory() { logger.info("Custom AST class not found"); File destination = new File(compiledJavaccFile.getAbsolutePath().replace(outputDirectory.getAbsolutePath(), targetDirectory.getAbsolutePath())); logger.info("Copying compiled file {} to {}", compiledJavaccFile, destination); try { FileUtils.copyFile(compiledJavaccFile, destination); } catch (IOException e) { String errorMessage = String.format("Could not copy %s from %s to %s", compiledJavaccFile, outputDirectory, targetDirectory); throw new CompiledJavaccFileOperationException(errorMessage, e); } } CompiledJavaccFile(File file, File outputDirectory, FileTree customAstClassesDirectory, File targetDirectory, Logger logger); boolean customAstClassExists(); boolean customAstClassExists(FileTree fileTree); void copyCompiledFileToTargetDirectory(); void copyCustomAstClassToTargetDirectory(FileTree sourceTree); void ignoreCompiledFileAndUseCustomAstClassFromJavaSourceTree(FileTree javaSourceTree); @Override String toString();  }### Answer:
@Test public void copyCompiledFileToTargetDirectory() { File expectedFile = new File(targetDirectory, "FileWithNoCorrespondingCustomAstClass.java"); assertFalse(expectedFile.exists()); File file = new File(outputDirectory, "FileWithNoCorrespondingCustomAstClass.java"); CompiledJavaccFile compiledJavaccFile = new CompiledJavaccFile(file, outputDirectory, customAstClassesDirectory, targetDirectory, logger); compiledJavaccFile.copyCompiledFileToTargetDirectory(); assertTrue(expectedFile.exists()); }
@Test(expected = CompiledJavaccFileOperationException.class) public void copyCompiledFileToTargetDirectoryFails() { File file = new File(outputDirectory, "DoesNotExist.java"); CompiledJavaccFile compiledJavaccFile = new CompiledJavaccFile(file, outputDirectory, customAstClassesDirectory, targetDirectory, logger); compiledJavaccFile.copyCompiledFileToTargetDirectory(); }