1
2
3
4 package net.sourceforge.pmd.ant;
5
6 import org.junit.Test;
7
8 public class PMDTaskTest extends AbstractAntTestHelper {
9
10 public PMDTaskTest() {
11 super.antTestScriptFilename = "pmdtasktest.xml";
12 }
13
14 @Test
15 public void testNoFormattersValidation() {
16 executeTarget("testNoFormattersValidation");
17 assertOutputContaining("Fields should be declared at the top of the class");
18 }
19
20 @Test
21 public void testNestedRuleset() {
22 executeTarget("testNestedRuleset");
23 assertOutputContaining("Avoid really long methods");
24 assertOutputContaining("Fields should be declared at the");
25 }
26
27 @Test
28 public void testFormatterWithProperties() {
29 executeTarget("testFormatterWithProperties");
30 assertOutputContaining("Avoid really long methods");
31 assertOutputContaining("Fields should be declared at the");
32 assertOutputContaining("link_prefix");
33 assertOutputContaining("line_prefix");
34 }
35
36 @Test
37 public void testAbstractNames() {
38 executeTarget("testAbstractNames");
39 assertOutputContaining("Avoid really long methods");
40 assertOutputContaining("Fields should be declared at the");
41 }
42
43 @Test
44 public void testAbstractNamesInNestedRuleset() {
45 executeTarget("testAbstractNamesInNestedRuleset");
46 assertOutputContaining("Avoid really long methods");
47 assertOutputContaining("Fields should be declared at the");
48 }
49
50 @Test
51 public void testCommaInRulesetfiles() {
52 executeTarget("testCommaInRulesetfiles");
53 assertOutputContaining("Avoid really long methods");
54 assertOutputContaining("Fields should be declared at the");
55 }
56
57 @Test
58 public void testRelativeRulesets() {
59 executeTarget("testRelativeRulesets");
60 assertOutputContaining("Avoid really long methods");
61 assertOutputContaining("Fields should be declared at the");
62 }
63
64 @Test
65 public void testRelativeRulesetsInRulesetfiles() {
66 executeTarget("testRelativeRulesetsInRulesetfiles");
67 assertOutputContaining("Avoid really long methods");
68 assertOutputContaining("Fields should be declared at");
69 }
70
71 @Test
72 public void testExplicitRuleInRuleSet() {
73 executeTarget("testExplicitRuleInRuleSet");
74 assertOutputContaining("Avoid really long methods");
75 }
76
77 @Test
78 public void testClasspath() {
79 executeTarget("testClasspath");
80 }
81 }