You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some projects use JUnit's @Test and other projects use TestNG's @Test. Sometimes both of these annotations are available on the classpath via dependencies. If a programmer picks the wrong one in an autocomplete popup, then they think the test case will be tested but in fact it will be ignored. Code review won't likely catch the problem since most people ignore the imports. Even if code coverage is being enforced, the programmer will struggle to figure out why their test case is not running.
Code Sample:
The following code compiles but never runs if the project is using TestNG.
import org.junit.Test;
@Test
public static void myTest()
{
}
The following code compiles but never runs if the project is using JUnit.
import org.testng.annotations.Test;
@Test
public static void myTest()
{
}
Properties:
framework: should be one of [JUnit | TestNG]. It could default to JUnit since that seems to be more popular.
Activity
[-][java] Use the correct @Test annotation[/-][+][java] New Rule: WrongTestAnnotation[/+][doc] Update release notes (pmd#2846)
[doc] Update release notes (pmd#2846)
[doc] Update release notes (pmd#2846)
[doc] Update release notes (pmd#2846)
[doc] Update release notes (pmd#2846)
[java] Fix #2846: New Rule: WrongTestAnnotation (#6735)