New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] False Alarm of JUnit4TestShouldUseTestAnnotation on Predicates #572

Closed
havrikov opened this Issue Aug 22, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@havrikov

havrikov commented Aug 22, 2017

Rule Set:
JUnit4TestShouldUseTestAnnotation

Description:
This rule will falsely report a missing @Test annotation on classes implementing the test method of the java.util.Predicate interface.

Code Sample demonstrating the issue:

public final class Whatever<T> implements Predicate<T> {
    @Override
    public boolean test(T t) {
        return false;
    }
}

Running PMD through: any

@jsotuyod

This comment has been minimized.

Show comment
Hide comment
@jsotuyod

jsotuyod Aug 22, 2017

Member

@havrikov thanks for the report.

Effectively, this migration tools is not checking if the container class is a test (either JUnit 3 or 4).

We should probably rewrite this XPath rule to Java, extending from AbstractJUnitRule, and apply the rule only to test classes, regardless of the JUnit version being used.

Member

jsotuyod commented Aug 22, 2017

@havrikov thanks for the report.

Effectively, this migration tools is not checking if the container class is a test (either JUnit 3 or 4).

We should probably rewrite this XPath rule to Java, extending from AbstractJUnitRule, and apply the rule only to test classes, regardless of the JUnit version being used.

adangel added a commit to adangel/pmd that referenced this issue May 17, 2018

@adangel adangel added the has:pr label May 17, 2018

@jsotuyod jsotuyod closed this in #1111 May 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment