1   /***
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3   */
4   package test.net.sourceforge.pmd.rules.strictexception;
5   
6   import net.sourceforge.pmd.PMD;
7   import net.sourceforge.pmd.rules.strictexception.ExceptionSignatureDeclaration;
8   import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst;
9   import test.net.sourceforge.pmd.testframework.TestDescriptor;
10  
11  public class ExceptionSignatureDeclarationRuleTest extends SimpleAggregatorTst {
12  
13      public void testAll() {
14         runTests(new TestDescriptor[] {
15             new TestDescriptor(TEST1, "method throws Exception", 1, new ExceptionSignatureDeclaration()),
16             new TestDescriptor(TEST2, "ok", 0, new ExceptionSignatureDeclaration()),
17             new TestDescriptor(TEST3, "constructor throws Exception", 1, new ExceptionSignatureDeclaration()),
18         });
19      }
20  
21      private static final String TEST1 =
22      "public class Foo {" + PMD.EOL +
23      " void foo() throws Exception {}" + PMD.EOL +
24      "}";
25  
26      private static final String TEST2 =
27      "public class Foo {" + PMD.EOL +
28      " void foo() {}" + PMD.EOL +
29      "}";
30  
31      private static final String TEST3 =
32      "public class Foo {" + PMD.EOL +
33      " Foo() throws Exception {}" + PMD.EOL +
34      "}";
35  
36  
37  }