1 package test.net.sourceforge.pmd.ant;
2
3 import junit.framework.TestCase;
4 import net.sourceforge.pmd.ant.Formatter;
5 import net.sourceforge.pmd.ant.PMDTask;
6 import org.apache.tools.ant.BuildException;
7
8 public class PMDTaskTest extends TestCase {
9
10 public void testNoFormattersValidation() {
11 PMDTask task = new PMDTask();
12 try {
13 task.execute();
14 throw new RuntimeException("Should have thrown a BuildException - no Formatters");
15 } catch (BuildException be) {
16 // cool
17 }
18 }
19
20 public void testFormatterWithNoToFileAttribute() {
21 PMDTask task = new PMDTask();
22 task.addFormatter(new Formatter());
23 try {
24 task.execute();
25 throw new RuntimeException("Should have thrown a BuildException - a Formatter was missing a toFile attribute");
26 } catch (BuildException be) {
27 // cool
28 }
29 }
30
31 public void testNoRuleSets() {
32 PMDTask task = new PMDTask();
33 task.setPrintToConsole(true);
34 try {
35 task.execute();
36 throw new RuntimeException("Should have thrown a BuildException - no rulesets");
37 } catch (BuildException be) {
38 // cool
39 }
40 }
41
42 }
This page was automatically generated by Maven