mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
Java: remove mention of abstract classes from qhelp
This commit is contained in:
@@ -37,7 +37,7 @@ public class IntegerOperationTest {
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
This rule is focused on missing `@Nested` annotations on non-static nested (inner) test classes. Static nested test classes and abstract nested test classes should not be annotated with `@Nested`. As a result, the absence of a `@Nested` annotation on such classes is compliant. Identifying incorrect application of a `@Nested` annotation to static and abstract classes is out of scope for this rule.
|
||||
This rule is focused on missing `@Nested` annotations on non-static nested (inner) test classes. Static nested test classes should not be annotated with `@Nested`. As a result, the absence of a `@Nested` annotation on such classes is compliant. Identifying incorrect application of a `@Nested` annotation to static nested classes is out of scope for this rule.
|
||||
|
||||
## References
|
||||
|
||||
|
||||
@@ -87,29 +87,20 @@ public class AnnotationTest {
|
||||
}
|
||||
}
|
||||
|
||||
// COMPLIANT: Invalid to use `@Nested` on an abstract class, but
|
||||
// this matter is out of scope (see QHelp Implementation Notes)
|
||||
@Nested
|
||||
public abstract class Test8 {
|
||||
@Test
|
||||
public void test() {
|
||||
}
|
||||
}
|
||||
|
||||
interface Test9 {
|
||||
interface Test8 {
|
||||
}
|
||||
|
||||
public void f() {
|
||||
// COMPLIANT: anonymous classes are not considered as inner test
|
||||
// classes by JUnit and therefore don't need `@Nested`
|
||||
new Test9() {
|
||||
new Test8() {
|
||||
@Test
|
||||
public void test() {
|
||||
}
|
||||
};
|
||||
// COMPLIANT: local classes are not considered as inner test
|
||||
// classes by JUnit and therefore don't need `@Nested`
|
||||
class Test10 {
|
||||
class Test9 {
|
||||
@Test
|
||||
void test() {
|
||||
}
|
||||
@@ -118,7 +109,7 @@ public class AnnotationTest {
|
||||
|
||||
// COMPLIANT: private classes are not considered as inner test
|
||||
// classes by JUnit and therefore don't need `@Nested`
|
||||
private class Test11 {
|
||||
private class Test10 {
|
||||
@Test
|
||||
public void test() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user