KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > net > sourceforge > pmd > rules > design > ExcessiveMethodLengthTest


1
2  /**
3   * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
4   */

5  package test.net.sourceforge.pmd.rules.design;
6  
7  import net.sourceforge.pmd.Rule;
8  import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst;
9  import test.net.sourceforge.pmd.testframework.TestDescriptor;
10  
11  public class ExcessiveMethodLengthTest extends SimpleAggregatorTst {
12      private Rule rule;
13      private TestDescriptor[] tests;
14  
15      public void setUp() {
16          rule = findRule("codesize", "ExcessiveMethodLength");
17          tests = extractTestsFromXml(rule);
18      }
19  
20      public void testAll() {
21          rule.addProperty("minimum", "10");
22          runTests(tests);
23      }
24
25  /*
26      public void testOverrideMinimumWithTopScore() throws Throwable {
27          Rule r = findRule("codesize", "ExcessiveMethodLength");
28          r.addProperty("minimum", "1");
29          r.addProperty("topscore", "2");
30          Report rpt = new Report();
31          runTestFromString(tests[5].getCode(), r, rpt);
32          for (Iterator i = rpt.iterator(); i.hasNext();) {
33              RuleViolation rv = (RuleViolation)i.next();
34              assertTrue(rv.getLine() == 2 || rv.getLine() == 6);
35          }
36      }
37  */

38  
39  }
40  
41
Popular Tags