Skip to content

Commit

Permalink
Add test cases for pmd#1592
Browse files Browse the repository at this point in the history
  • Loading branch information
jsotuyod committed Mar 31, 2024
1 parent a47a301 commit 86328b7
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,22 @@

package net.sourceforge.pmd.lang.java.rule.bestpractices;

import org.junit.After;
import org.junit.Before;

import net.sourceforge.pmd.test.PmdRuleTst;

class JUnit4TestShouldUseAfterAnnotationTest extends PmdRuleTst {
// no additional unit tests

public static class BaseTest {
@Before
public void setUp() {
// A setup code
}
@After
public void tearDown() {
// A tear down code
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,22 @@

package net.sourceforge.pmd.lang.java.rule.bestpractices;

import org.junit.After;
import org.junit.Before;

import net.sourceforge.pmd.test.PmdRuleTst;

class JUnit4TestShouldUseBeforeAnnotationTest extends PmdRuleTst {
// no additional unit tests

public static class BaseTest {
@Before
public void setUp() {
// A setup code
}
@After
public void tearDown() {
// A tear down code
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,24 @@ public class Foo {
}
]]></code>
</test-code>

<test-code>
<description>[java] JUnit4TestShouldUseBeforeAnnotation false positive when overriding setUp #1592</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import net.sourceforge.pmd.lang.java.rule.bestpractices.JUnit4TestShouldUseBeforeAnnotationTest.BaseTest;
public class AReallyCoolFeatureTest extends BaseTest {
@Override
public void setUp() {
super.setUp();
}
@Override
public void tearDown() {
super.tearDown();
}
}
]]></code>
</test-code>
</test-data>
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,24 @@ public class Foo {
}
]]></code>
</test-code>

<test-code>
<description>[java] JUnit4TestShouldUseBeforeAnnotation false positive when overriding setUp #1592</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import net.sourceforge.pmd.lang.java.rule.bestpractices.JUnit4TestShouldUseBeforeAnnotationTest.BaseTest;
public class AReallyCoolFeatureTest extends BaseTest {
@Override
public void setUp() {
super.setUp();
}
@Override
public void tearDown() {
super.tearDown();
}
}
]]></code>
</test-code>
</test-data>

0 comments on commit 86328b7

Please sign in to comment.