AbstractAntExecutor { public void executeAntTask(final String filePath, final PrintStream errorStream, final PrintStream outputStream, final String temporaryDir) throws APIRestGeneratorException { final File buildFile = new File(this.generatorBuilderPath + File.separator + this.antFile); final Project project = this.generateProject(filePath, errorStream, outputStream, temporaryDir, buildFile); try { project.fireBuildStarted(); project.init(); final ProjectHelper projectHelper = ProjectHelper.getProjectHelper(); project.addReference(ConstantsAnt.ANT_REF_PROJECT_HELPER, projectHelper); projectHelper.parse(project, buildFile); project.executeTarget(this.getGoalTask()); project.fireBuildFinished(null); } catch (BuildException buildException) { project.fireBuildFinished(buildException); final String errorString = "BuildException while calling the ANT task with the following parameters: [antFile: " + this.antFile + ", filePath: " + filePath + "]"; AbstractAntExecutor.LOGGER.error(errorString, buildException); throw new APIRestGeneratorException(errorString, buildException); } } AbstractAntExecutor(final String generatorBuilderPath,
                               final String antFile,
                               final String translatorType,
                               final String fullPkgLauncherClass,
                               final String parserType,
                               final String deliverableFileName); void executeAntTask(final String filePath,
                               final PrintStream errorStream,
                               final PrintStream outputStream,
                               final String temporaryDir);  }
@Test public void fullTest() throws APIRestGeneratorException { final MyAntExecutor myAntExecutor = new MyAntExecutor(ConstantsTest.SRC_TEST_RESOURCES_PATH, ConstantsTest.ANT_FILE, ConstantsTest.TRANSLATOR_TYPE, FULL_PKG_LAUNCHER_CLASS, ConstantsTest.PARSER_TYPE, DELIVERABLE_FILE_NAME) ; myAntExecutor.executeAntTask(FILE_PATH, System.err, System.out, TEMPORARY_DIR) ; }