Skip to content

Commit

Permalink
Update ExcludeLinesTest
Browse files Browse the repository at this point in the history
  • Loading branch information
oowekyala committed Apr 15, 2022
1 parent 715442b commit 359225c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
23 changes: 16 additions & 7 deletions pmd-java/src/test/java/net/sourceforge/pmd/ExcludeLinesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -49,12 +49,21 @@ public void testAlternateMarker() throws Exception {
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" +
"}";
}
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit 359225c

Please sign in to comment.