View Javadoc
1 package test.net.sourceforge.pmd.rules; 2 3 import net.sourceforge.pmd.PMD; 4 import net.sourceforge.pmd.rules.VariableNamingConventionsRule; 5 6 public class VariableNamingConventionsRuleTest extends SimpleAggregatorTst { 7 8 public void testAll() { 9 runTests(new TestDescriptor[] { 10 new TestDescriptor(TEST1, "finals should be all caps", 1, new VariableNamingConventionsRule()), 11 new TestDescriptor(TEST2, "non-finals shouldn't have underscores", 1, new VariableNamingConventionsRule()), 12 new TestDescriptor(TEST3, "variables names should start with lowercase character", 1, new VariableNamingConventionsRule()), 13 new TestDescriptor(TEST4, "all is well", 0, new VariableNamingConventionsRule()), 14 }); 15 } 16 17 private static final String TEST1 = 18 "public class Foo {" + PMD.EOL + 19 " private static final int foo = 2;" + PMD.EOL + 20 "}"; 21 22 private static final String TEST2 = 23 "public class Foo {" + PMD.EOL + 24 " private int foo_bar = 2;" + PMD.EOL + 25 "}"; 26 27 private static final String TEST3 = 28 "public class Foo {" + PMD.EOL + 29 " private int Ubar = 2;" + PMD.EOL + 30 "}"; 31 32 private static final String TEST4 = 33 "public class Foo {" + PMD.EOL + 34 " private int bar = 2;" + PMD.EOL + 35 " private static final int FOO_BAR = 2;" + PMD.EOL + 36 "}"; 37 }

This page was automatically generated by Maven