BAEL-6839: Updated pmd unit tests rule - Allow tests ending with "jmhTest" and disallow ones ending with "Tests" (#4411)
* BAEL-6839: Updated the unit tests convention pmd rule - Don't allow unit tests ending with "Tests" and allow the ones ending with "jmhTest" ("*jmhTest" are autogenerated) * fixed formatting issue - Replaced tabs with spaces
This commit is contained in:
parent
2e683411e2
commit
eb746f5ac6
Binary file not shown.
|
@ -14,17 +14,16 @@ public class UnitTestNamingConventionRule extends AbstractJavaRule {
|
|||
"ManualTest",
|
||||
"JdbcTest",
|
||||
"LiveTest",
|
||||
"UnitTest");
|
||||
"UnitTest",
|
||||
"jmhTest");
|
||||
|
||||
public Object visit(ASTClassOrInterfaceDeclaration node, Object data) {
|
||||
String className = node.getImage();
|
||||
Objects.requireNonNull(className);
|
||||
|
||||
if (className.endsWith("Test") || className.endsWith("Tests")) {
|
||||
if (allowedEndings.stream()
|
||||
.noneMatch(className::endsWith)) {
|
||||
addViolation(data, node);
|
||||
}
|
||||
if (className.endsWith("Tests")
|
||||
|| (className.endsWith("Test") && allowedEndings.stream().noneMatch(className::endsWith))) {
|
||||
addViolation(data, node);
|
||||
}
|
||||
|
||||
return data;
|
||||
|
|
Loading…
Reference in New Issue