Update ExcludeLinesTest

This commit is contained in:
Clément Fournier
2022-04-15 19:34:55 +02:00
parent 715442b66b
commit 359225ca37
2 changed files with 17 additions and 8 deletions

View File

@ -23,7 +23,7 @@ public class ExcludeLinesTest extends RuleTst {
@Before
public void setUp() {
rule = findRule("java-unusedcode", "UnusedLocalVariable");
rule = findRule("rulesets/testing/test-rset-3.xml", "PrintsVariableNames");
}
@Test
@ -49,12 +49,21 @@ public class ExcludeLinesTest extends RuleTst {
assertEquals(r.getSuppressedRuleViolations().size(), 1);
}
private static final String TEST1 = "public class Foo {" + PMD.EOL + " void foo() {" + PMD.EOL + " int x; //NOPMD "
+ PMD.EOL + " } " + PMD.EOL + "}";
private static final String TEST1 = "public class Foo {\n" +
" void foo() {\n" +
" int x; //NOPMD \n" +
" } \n" +
"}";
private static final String TEST2 = "public class Foo {" + PMD.EOL + " void foo() {" + PMD.EOL + " int x;"
+ PMD.EOL + " } " + PMD.EOL + "}";
private static final String TEST2 = "public class Foo {\n" +
" void foo() {\n" +
" int x;\n" +
" } \n" +
"}";
private static final String TEST3 = "public class Foo {" + PMD.EOL + " void foo() {" + PMD.EOL
+ " int x; // FOOBAR" + PMD.EOL + " } " + PMD.EOL + "}";
private static final String TEST3 = "public class Foo {\n" +
" void foo() {\n" +
" int x; // FOOBAR\n" +
" } \n" +
"}";
}

View File

@ -7,7 +7,7 @@
Ruleset used by test RuleSetReferenceIdTest
</description>
<rule name="DummyRuleWithAViolationPerFile"
<rule name="PrintsVariableNames"
language="java"
since="1.0"
message="Violation from test-rset-3.xml: name {0}"