FlexCpdAntTask extends Task { @Override public void execute() { try { validateFields(); new LoggerUtils().loadConfiguration(); log( "Starting run, minimumTokenCount is " + minimumTokenCount, Project.MSG_INFO ); log( "Tokenizing files", Project.MSG_INFO ); final CPD cpd = new CPD( minimumTokenCount, new FlexLanguage() ); cpd.setEncoding( encoding ); tokenizeFiles( cpd ); log( "Starting to analyze code", Project.MSG_INFO ); final long timeTaken = analyzeCode( cpd ); log( "Done analyzing code; that took " + timeTaken + " milliseconds" ); log( "Generating report", Project.MSG_INFO ); report( cpd ); } catch ( final IOException ioe ) { log( ioe.toString(), Project.MSG_ERR ); throw new BuildException( "IOException during task execution", ioe ); } catch ( final ReportException re ) { log( re.toString(), Project.MSG_ERR ); throw new BuildException( "ReportException during task execution", re ); } }  void addFileset( final FileSet set ); @Override void execute(); void setEncoding( final String encodingValue ); void setMinimumTokenCount( final int minimumTokenCountToBeSet ); void setOutputFile( final File outputFileToBeSet );  }
@Test public void testExecute() { final FlexCpdAntTask task = new FlexCpdAntTask(); final FileSet set = new FileSet(); final Project project = new Project(); set.setDir( getTestDirectory() ); task.setProject( project ); task.addFileset( set ); task.execute(); }