Java: tests to inline expectations

This commit is contained in:
Jami Cogswell
2025-03-21 15:33:15 -04:00
parent f17e7266cf
commit b08c8d020d
3 changed files with 8 additions and 4 deletions

View File

@@ -9,7 +9,8 @@ public class AnnotationTest {
}
}
public class Test2 { // NON_COMPLIANT: Inner test class is missing a `@Nested`
// NON_COMPLIANT: Inner test class is missing `@Nested`
public class Test2 { // $ Alert
@Test
public void test() {
}
@@ -35,8 +36,10 @@ public class AnnotationTest {
}
}
// COMPLIANT: Invalid to use `@Nested` on a static class, but
// this matter is out of scope (see QHelp Implementation Notes)
@Nested
public static class Test6 { // COMPLIANT: Although invalid, this matter is out of the scope (see Implementation Details)
public static class Test6 {
@Test
public void test() {
}

View File

@@ -1 +1 @@
| AnnotationTest.java:12:16:12:20 | Test2 | This JUnit5 inner test class lacks a @Nested annotation. |
| AnnotationTest.java:13:16:13:20 | Test2 | This JUnit5 inner test class lacks a '@Nested' annotation. |

View File

@@ -1 +1,2 @@
Likely Bugs/Frameworks/JUnit/JUnit5NonStaticInnerClassMissingNestedAnnotation.ql
query: Likely Bugs/Frameworks/JUnit/JUnit5NonStaticInnerClassMissingNestedAnnotation.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql