FlexPmdAntTask extends Task { @Override public final void execute() { try { presetParameters(); new LoggerUtils().loadConfiguration(); final FlexPmdXmlEngine engine = new FlexPmdXmlEngine( new FlexPmdParameters( packageToExclude, outputDirectory, ruleSet, sourceDirectory ) ); final FlexPmdViolations violations = new FlexPmdViolations(); engine.executeReport( violations ); if ( failOnError ) { final String message = PmdEngineUtils.findFirstViolationError( violations ); if ( message.length() > 0 ) { throw new BuildException( message ); } } if ( failOnRuleViolation && !violations.getViolations().isEmpty() ) { throw new BuildException( "At least one violation has been found" ); } } catch ( final Exception e ) { throw new BuildException( e ); } }  @Override final void execute(); final String getPackageToExclude(); final void setFailOnError( final boolean failOnErrorToBeSet ); final void setFailOnRuleViolation( final boolean failOnRuleViolation ); final void setOutputDirectory( final File outputDirectoryToBeSet ); final void setPackageToExclude( final String packageToExcludeToBeSet ); final void setRuleSet( final File ruleSetToBeSet ); final void setSourceDirectory( final File sourceDirectoryToBeSet );  }
@Test(expected = BuildException.class) public void testExecuteWithoutSettingParameters() { final FlexPmdAntTask task = new FlexPmdAntTask(); final Project project = new Project(); task.setProject( project ); task.execute(); }