    1   /***
    2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
    3    */
    4   package test.net.sourceforge.pmd.rules;
    5
    6   import net.sourceforge.pmd.Rule;
    7   import net.sourceforge.pmd.RuleSetNotFoundException;
    8   import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst;
    9   import test.net.sourceforge.pmd.testframework.TestDescriptor;
    10
    11  public class AbstractNamingTest extends SimpleAggregatorTst {
    12
    13      private Rule rule;
    14
    15      public void setUp() throws RuleSetNotFoundException {
    16          rule = findRule("naming", "AbstractNaming");
    17      }
    18
    19      public void testAll() {
    20          runTests(new TestDescriptor[]{
    21              new TestDescriptor(TEST1, "ok, abstract class AbstractFoo", 0, rule),
    22              new TestDescriptor(TEST2, "bad, abstract class named Foo", 1, rule),
    23              new TestDescriptor(TEST3, "ok, concrete class named AbstractFoo", 0, rule),
    24              new TestDescriptor(TEST4, "ok, concrete class named Foo", 0, rule),
    25          });
    26      }
    27
    28      private static final String TEST1 =
    29              "public abstract class AbstractFoo {}";
    30
    31      private static final String TEST2 =
    32              "public abstract class Foo {}";
    33
    34      private static final String TEST3 =
    35              "public class AbstractFoo {}";
    36
    37      private static final String TEST4 =
    38              "public class Foo {}";
    39  }