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
The rule "JUnit5TestNoPrivateModifier" would probably also apply to JUnit4, so the name could also be "JUnitTestWrongModifier" (for JUnit4, private, protected and no modifier would be flagged, for JUnit5 only private modifier would be flagged).
Code Sample: This should include code, that should be flagged by the rule. If possible, the "correct" code
according to this new rule should also be demonstrated.
classMyTest { // not public, that's fine@TestprivatevoidtestBad() { } // private test methods don't work@TestvoidtestGoodJunit5() { } // package private as expected for JUnit5@TestpublicvoidtestGoodJunit4() { } // public test method for JUnit4
}
Possible Properties:
No properties. The rule should be smart enough to distinguish between JUnit5 and JUnit4 automatically.
The text was updated successfully, but these errors were encountered:
Proposed Rule Name: JUnit5TestNoPrivateModifier
Proposed Category: Error Prone
Description:
See discussion in #3239. The rule should flag test methods / test classes, that are private, since they can't be executed by JUnit(5).
Sonar has a similar rule: https://rules.sonarsource.com/java/tag/tests/RSPEC-5810
Code Sample: This should include code, that should be flagged by the rule. If possible, the "correct" code
according to this new rule should also be demonstrated.
Possible Properties:
The text was updated successfully, but these errors were encountered: