Skip to content

Commit 1210901

Browse files
committed
Suppress IDEA's "malformed declaration" warning for TestCase classes
1 parent 43c8341 commit 1210901

File tree

89 files changed

+371
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+371
-8
lines changed

documentation/src/test/java/example/TempDirectoryDemo.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ void copyFileFromSourceToTarget(@TempDir Path source, @TempDir Path target) thro
6363
}
6464
// end::user_guide_multiple_directories[]
6565

66+
@SuppressWarnings("JUnitMalformedDeclaration")
6667
static
6768
// tag::user_guide_field_injection[]
6869
class SharedTempDirectoryDemo {
@@ -87,6 +88,7 @@ void anotherTestThatUsesTheSameTempDir() {
8788
}
8889
// end::user_guide_field_injection[]
8990

91+
@SuppressWarnings("JUnitMalformedDeclaration")
9092
static
9193
// tag::user_guide_cleanup_mode[]
9294
class CleanupModeDemo {
@@ -99,6 +101,7 @@ void fileTest(@TempDir(cleanup = ON_SUCCESS) Path tempDir) {
99101
}
100102
// end::user_guide_cleanup_mode[]
101103

104+
@SuppressWarnings("JUnitMalformedDeclaration")
102105
static
103106
// tag::user_guide_factory_name_prefix[]
104107
class TempDirFactoryDemo {
@@ -121,6 +124,7 @@ public Path createTempDirectory(AnnotatedElementContext elementContext, Extensio
121124
}
122125
// end::user_guide_factory_name_prefix[]
123126

127+
@SuppressWarnings("JUnitMalformedDeclaration")
124128
static
125129
// tag::user_guide_factory_jimfs[]
126130
class InMemoryTempDirDemo {
@@ -158,6 +162,7 @@ public void close() throws IOException {
158162
}
159163
// end::user_guide_composed_annotation[]
160164

165+
@SuppressWarnings("JUnitMalformedDeclaration")
161166
static
162167
// tag::user_guide_composed_annotation_usage[]
163168
class JimfsTempDirAnnotationDemo {

junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/VintageDiscovererTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ private TestDescriptor discover(EngineDiscoveryRequest request) {
125125
return new VintageDiscoverer().discover(request, engineId());
126126
}
127127

128+
@SuppressWarnings("JUnitMalformedDeclaration")
128129
public static class Foo {
129130

130131
@org.junit.Test
@@ -133,6 +134,7 @@ public void test() {
133134

134135
}
135136

137+
@SuppressWarnings("JUnitMalformedDeclaration")
136138
public static class Bar {
137139

138140
@org.junit.Test

junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3ParallelSuiteWithSubsuites.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import junit.framework.TestCase;
1515
import junit.framework.TestSuite;
1616

17+
@SuppressWarnings("JUnitMalformedDeclaration")
1718
public class JUnit3ParallelSuiteWithSubsuites extends TestCase {
1819
private final String arg;
1920

junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3SuiteWithSubsuites.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import junit.framework.TestCase;
1414
import junit.framework.TestSuite;
1515

16+
@SuppressWarnings("JUnitMalformedDeclaration")
1617
public class JUnit3SuiteWithSubsuites extends TestCase {
1718
private final String arg;
1819

jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationInheritanceTestCase.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ void this_is_a_test() {
2626
}
2727
}
2828

29+
@SuppressWarnings("JUnitMalformedDeclaration")
2930
static class StaticNestedTestCase {
3031

3132
@Test

jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationTests.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ static class UnderscoreStyleInheritedFromSuperClassTestCase extends UnderscoreSt
287287

288288
// -------------------------------------------------------------------
289289

290+
@SuppressWarnings("JUnitMalformedDeclaration")
290291
@DisplayName("A stack")
291292
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
292293
static class StackTestCase {
@@ -353,6 +354,7 @@ void peek_returns_that_element_without_removing_it_from_the_stack() {
353354

354355
// -------------------------------------------------------------------
355356

357+
@SuppressWarnings("JUnitMalformedDeclaration")
356358
@DisplayName("A stack")
357359
@IndicativeSentencesGeneration(generator = DisplayNameGenerator.ReplaceUnderscores.class)
358360
static class IndicativeGeneratorTestCase {
@@ -397,6 +399,7 @@ void is_no_longer_empty() {
397399

398400
// -------------------------------------------------------------------
399401

402+
@SuppressWarnings("JUnitMalformedDeclaration")
400403
@DisplayName("A stack")
401404
@IndicativeSentencesGeneration(separator = " >> ", generator = DisplayNameGenerator.ReplaceUnderscores.class)
402405
static class IndicativeGeneratorWithCustomSeparatorTestCase {

jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesGenerationInheritanceTestCase.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ void this_is_a_test() {
2626
}
2727
}
2828

29+
@SuppressWarnings("JUnitMalformedDeclaration")
2930
static class StaticNestedTestCase {
3031

3132
@Test

jupiter-tests/src/test/java/org/junit/jupiter/api/extension/CloseableResourceIntegrationTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ void closesCloseableResourcesInReverseInsertOrder() {
3535
reportEntry(Map.of("1", "closed")));
3636
}
3737

38+
@SuppressWarnings("JUnitMalformedDeclaration")
3839
@ExtendWith(ExtensionContextParameterResolver.class)
3940
static class TestCase {
4041
@Test
@@ -64,6 +65,7 @@ void exceptionsDuringCloseAreReportedAsSuppressed() {
6465
))));
6566
}
6667

68+
@SuppressWarnings("JUnitMalformedDeclaration")
6769
@ExtendWith(ThrowingOnCloseExtension.class)
6870
static class ExceptionInCloseableResourceTestCase {
6971

jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExecutableInvokerIntegrationTests.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ void invokeMethodViaExtensionContext() {
3939
assertEquals(2, ExecuteTestsTwiceTestCase.testInvocations);
4040
}
4141

42+
@SuppressWarnings("JUnitMalformedDeclaration")
4243
@ExtendWith(ExecuteTestsTwiceExtension.class)
4344
static class ExecuteTestsTwiceTestCase {
4445

4546
static int testInvocations = 0;
4647

48+
@SuppressWarnings("JUnitMalformedDeclaration")
4749
@Test
4850
void testWithResolvedParameter(TestInfo testInfo,
4951
@ExtendWith(ExtensionContextParameterResolver.class) ExtensionContext extensionContext) {
@@ -54,6 +56,7 @@ void testWithResolvedParameter(TestInfo testInfo,
5456

5557
}
5658

59+
@SuppressWarnings("JUnitMalformedDeclaration")
5760
@ExtendWith(ExecuteConstructorTwiceExtension.class)
5861
static class ExecuteConstructorTwiceTestCase {
5962

jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeAllAndAfterAllComposedAnnotationTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ void beforeAllAndAfterAllAsMetaAnnotations() {
3939
assertThat(methodsInvoked).containsExactly("beforeAll", "test", "afterAll");
4040
}
4141

42+
@SuppressWarnings("JUnitMalformedDeclaration")
4243
static class TestCase {
4344

4445
@CustomBeforeAll

0 commit comments

Comments
 (0)