FlexCPD { static boolean startFlexCPD( final String[] args ) throws JSAPException, URISyntaxException, IOException, ReportException, PMDException { if ( areCommandLineOptionsCorrect( args ) ) { final String minimumTokens = getParameterValue( CpdCommandLineOptions.MINIMUM_TOKENS ); final String source = getParameterValue( CommandLineOptions.SOURCE_DIRECTORY ); final File sourceDirectory = source.contains( "," ) ? null : new File( source ); final List< File > sourceList = CommandLineUtils.computeSourceList( source ); final File outputDirectory = new File( getParameterValue( CpdCommandLineOptions.OUTPUT_FILE ) ); parameters = new FlexCpdParameters( outputDirectory, minimumTokens == null ? FlexTokenizer.DEFAULT_MINIMUM_TOKENS : Integer.valueOf( minimumTokens ), sourceDirectory, sourceList ); LOGGER.info( "Starting run, minimumTokenCount is " + parameters.getMinimumTokenCount() ); LOGGER.info( "Tokenizing files" ); final CPD cpd = new CPD( parameters.getMinimumTokenCount(), new FlexLanguage() ); cpd.setEncoding( ENCODING ); tokenizeFiles( cpd ); LOGGER.info( "Starting to analyze code" ); final long timeTaken = analyzeCode( cpd ); LOGGER.info( "Done analyzing code; that took " + timeTaken + " milliseconds" ); LOGGER.info( "Generating report" ); report( cpd ); } return config.success(); } private  FlexCPD(); static void main( final String[] args );  }
@Test public void testStartFlexCPD() throws JSAPException, PMDException, URISyntaxException, IOException, ReportException { final String[] args = new String[] { "-s", getTestDirectory().getAbsolutePath(), "-o", new File( "target/cpd.xml" ).getAbsolutePath(), "--excludePackage", "cairngorm." }; FlexCPD.startFlexCPD( args ); }