From 12109012f6642a6c8ae3674cda5d9b7f0c961052 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 10 Oct 2024 16:26:43 +0200 Subject: [PATCH] Suppress IDEA's "malformed declaration" warning for TestCase classes --- .../test/java/example/TempDirectoryDemo.java | 5 ++++ .../discovery/VintageDiscovererTests.java | 2 ++ .../JUnit3ParallelSuiteWithSubsuites.java | 1 + .../junit3/JUnit3SuiteWithSubsuites.java | 1 + ...playNameGenerationInheritanceTestCase.java | 1 + .../api/DisplayNameGenerationTests.java | 3 ++ ...entencesGenerationInheritanceTestCase.java | 1 + .../CloseableResourceIntegrationTests.java | 2 ++ .../ExecutableInvokerIntegrationTests.java | 3 ++ ...AllAndAfterAllComposedAnnotationTests.java | 1 + ...chAndAfterEachComposedAnnotationTests.java | 1 + .../engine/DefaultExecutionModeTests.java | 2 ++ .../jupiter/engine/DefaultMethodTests.java | 2 ++ .../junit/jupiter/engine/DisabledTests.java | 2 ++ .../engine/ExceptionHandlingTests.java | 4 +++ .../engine/FailedAssumptionsTests.java | 2 ++ ...alidLifecycleMethodConfigurationTests.java | 9 ++++++ .../MultipleTestableAnnotationsTests.java | 2 ++ .../engine/NestedTestClassesTests.java | 4 +++ ...NonVoidTestableMethodIntegrationTests.java | 2 ++ .../engine/OverloadedTestMethodTests.java | 1 + .../org/junit/jupiter/engine/RecordTests.java | 1 + .../junit/jupiter/engine/ReportingTests.java | 1 + .../engine/StandardTestClassTests.java | 5 ++++ ...estedBeforeAllAndAfterAllMethodsTests.java | 1 + .../engine/TestClassInheritanceTests.java | 2 ++ ...stInstanceLifecycleConfigurationTests.java | 6 ++++ .../engine/TestInstanceLifecycleTests.java | 4 +++ .../descriptor/DisplayNameUtilsTests.java | 1 + .../JupiterTestDescriptorTests.java | 10 ++++++- .../descriptor/LifecycleMethodUtilsTests.java | 7 +++++ .../ClassWithStaticInnerTestCases.java | 3 +- .../DiscoverySelectorResolverTests.java | 2 ++ .../engine/discovery/DiscoveryTests.java | 1 + .../predicates/IsNestedTestClassTests.java | 2 ++ .../predicates/IsTestClassWithTestsTests.java | 3 ++ .../predicates/IsTestMethodTests.java | 6 ++++ ...singForArrayParameterIntegrationTests.java | 1 + .../engine/extension/AutoCloseTests.java | 6 ++++ .../extension/BeforeAndAfterAllTests.java | 6 ++++ .../extension/BeforeAndAfterEachTests.java | 8 +++++ ...oreAndAfterTestExecutionCallbackTests.java | 7 +++++ .../extension/ExecutionConditionTests.java | 2 ++ .../ExtensionContextExecutionTests.java | 1 + .../extension/InvocationInterceptorTests.java | 6 ++++ ...eMethodExecutionExceptionHandlerTests.java | 2 ++ .../engine/extension/OrderedMethodTests.java | 11 +++++-- ...rogrammaticExtensionRegistrationTests.java | 1 + .../extension/ParameterResolverTests.java | 13 +++++++++ ...rogrammaticExtensionRegistrationTests.java | 23 +++++++++++++++ .../engine/extension/RepeatedTestTests.java | 2 ++ .../extension/TempDirectoryCleanupTests.java | 11 +++++++ .../TempDirectoryMetaAnnotationTests.java | 2 ++ .../TempDirectoryPerContextTests.java | 25 +++++++++++++++- .../TempDirectoryPerDeclarationTests.java | 29 ++++++++++++++++++- .../TempDirectoryPreconditionTests.java | 3 ++ .../TestExecutionExceptionHandlerTests.java | 1 + .../extension/TestInstanceFactoryTests.java | 15 ++++++++++ ...stProcessorAndPreDestroyCallbackTests.java | 6 ++++ .../TestInstancePostProcessorTests.java | 2 ++ ...TestInstancePreConstructCallbackTests.java | 6 ++++ .../TestInstancePreDestroyCallbackTests.java | 3 ++ .../engine/extension/TestWatcherTests.java | 2 ++ .../extension/TimeoutExtensionTests.java | 21 ++++++++++++++ .../conditions/IgnoreConditionTests.java | 3 ++ .../rules/ExpectedExceptionSupportTests.java | 2 ++ ...pportForMixedMethodAndFieldRulesTests.java | 2 ++ ...rBasedEnableRuleMigrationSupportTests.java | 2 ++ .../ParameterizedTestExtensionTests.java | 1 + .../ParameterizedTestIntegrationTests.java | 1 + .../AggregatorIntegrationTests.java | 1 + .../platform/StackTracePruningTests.java | 2 ++ .../commons/support/ModifierSupportTests.java | 8 +++++ .../platform/console/ConsoleDetailsTests.java | 4 +++ .../ContainerForStaticNestedTest.java | 1 + .../ContainerForStaticNestedTests.java | 1 + .../ResourceLockAnnotationTests.java | 6 ++++ .../NodeTreeWalkerIntegrationTests.java | 6 ++++ .../SameThreadExecutionIntegrationTests.java | 1 + ...dingExecutionListenerIntegrationTests.java | 1 + .../launcher/TagIntegrationTests.java | 1 + .../LauncherConfigurationParametersTests.java | 1 + .../LauncherDiscoveryRequestBuilderTests.java | 1 + .../launcher/core/LauncherFactoryTests.java | 4 +-- ...queIdTrackingListenerIntegrationTests.java | 4 +++ .../engine/testcases/StatefulTestCase.java | 2 ++ .../testkit/engine/EngineTestKitTests.java | 1 + .../engine/ExecutionsIntegrationTests.java | 1 + .../NestedContainerEventConditionTests.java | 1 + 89 files changed, 371 insertions(+), 8 deletions(-) diff --git a/documentation/src/test/java/example/TempDirectoryDemo.java b/documentation/src/test/java/example/TempDirectoryDemo.java index 758710000fb3..451d8281816f 100644 --- a/documentation/src/test/java/example/TempDirectoryDemo.java +++ b/documentation/src/test/java/example/TempDirectoryDemo.java @@ -63,6 +63,7 @@ void copyFileFromSourceToTarget(@TempDir Path source, @TempDir Path target) thro } // end::user_guide_multiple_directories[] + @SuppressWarnings("JUnitMalformedDeclaration") static // tag::user_guide_field_injection[] class SharedTempDirectoryDemo { @@ -87,6 +88,7 @@ void anotherTestThatUsesTheSameTempDir() { } // end::user_guide_field_injection[] + @SuppressWarnings("JUnitMalformedDeclaration") static // tag::user_guide_cleanup_mode[] class CleanupModeDemo { @@ -99,6 +101,7 @@ void fileTest(@TempDir(cleanup = ON_SUCCESS) Path tempDir) { } // end::user_guide_cleanup_mode[] + @SuppressWarnings("JUnitMalformedDeclaration") static // tag::user_guide_factory_name_prefix[] class TempDirFactoryDemo { @@ -121,6 +124,7 @@ public Path createTempDirectory(AnnotatedElementContext elementContext, Extensio } // end::user_guide_factory_name_prefix[] + @SuppressWarnings("JUnitMalformedDeclaration") static // tag::user_guide_factory_jimfs[] class InMemoryTempDirDemo { @@ -158,6 +162,7 @@ public void close() throws IOException { } // end::user_guide_composed_annotation[] + @SuppressWarnings("JUnitMalformedDeclaration") static // tag::user_guide_composed_annotation_usage[] class JimfsTempDirAnnotationDemo { diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/VintageDiscovererTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/VintageDiscovererTests.java index 806e69769556..5ed15771d1ac 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/VintageDiscovererTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/VintageDiscovererTests.java @@ -125,6 +125,7 @@ private TestDescriptor discover(EngineDiscoveryRequest request) { return new VintageDiscoverer().discover(request, engineId()); } + @SuppressWarnings("JUnitMalformedDeclaration") public static class Foo { @org.junit.Test @@ -133,6 +134,7 @@ public void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") public static class Bar { @org.junit.Test diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3ParallelSuiteWithSubsuites.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3ParallelSuiteWithSubsuites.java index 5157c622dcce..fea0c802c957 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3ParallelSuiteWithSubsuites.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3ParallelSuiteWithSubsuites.java @@ -14,6 +14,7 @@ import junit.framework.TestCase; import junit.framework.TestSuite; +@SuppressWarnings("JUnitMalformedDeclaration") public class JUnit3ParallelSuiteWithSubsuites extends TestCase { private final String arg; diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3SuiteWithSubsuites.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3SuiteWithSubsuites.java index 3c11ed125bbb..390499a21f96 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3SuiteWithSubsuites.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3SuiteWithSubsuites.java @@ -13,6 +13,7 @@ import junit.framework.TestCase; import junit.framework.TestSuite; +@SuppressWarnings("JUnitMalformedDeclaration") public class JUnit3SuiteWithSubsuites extends TestCase { private final String arg; diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationInheritanceTestCase.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationInheritanceTestCase.java index e35aac0ba0b5..1d077189d2e8 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationInheritanceTestCase.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationInheritanceTestCase.java @@ -26,6 +26,7 @@ void this_is_a_test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class StaticNestedTestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationTests.java index fe051e37e3ee..cf692a4be153 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationTests.java @@ -287,6 +287,7 @@ static class UnderscoreStyleInheritedFromSuperClassTestCase extends UnderscoreSt // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("A stack") @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) static class StackTestCase { @@ -353,6 +354,7 @@ void peek_returns_that_element_without_removing_it_from_the_stack() { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("A stack") @IndicativeSentencesGeneration(generator = DisplayNameGenerator.ReplaceUnderscores.class) static class IndicativeGeneratorTestCase { @@ -397,6 +399,7 @@ void is_no_longer_empty() { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("A stack") @IndicativeSentencesGeneration(separator = " >> ", generator = DisplayNameGenerator.ReplaceUnderscores.class) static class IndicativeGeneratorWithCustomSeparatorTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesGenerationInheritanceTestCase.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesGenerationInheritanceTestCase.java index e0e779cf750b..c1e9d52f36f9 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesGenerationInheritanceTestCase.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesGenerationInheritanceTestCase.java @@ -26,6 +26,7 @@ void this_is_a_test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class StaticNestedTestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/CloseableResourceIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/CloseableResourceIntegrationTests.java index 7d7038849878..8ff419f9d6d6 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/CloseableResourceIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/CloseableResourceIntegrationTests.java @@ -35,6 +35,7 @@ void closesCloseableResourcesInReverseInsertOrder() { reportEntry(Map.of("1", "closed"))); } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExtensionContextParameterResolver.class) static class TestCase { @Test @@ -64,6 +65,7 @@ void exceptionsDuringCloseAreReportedAsSuppressed() { )))); } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ThrowingOnCloseExtension.class) static class ExceptionInCloseableResourceTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExecutableInvokerIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExecutableInvokerIntegrationTests.java index c3946331ec7e..f9b1458f349e 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExecutableInvokerIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExecutableInvokerIntegrationTests.java @@ -39,11 +39,13 @@ void invokeMethodViaExtensionContext() { assertEquals(2, ExecuteTestsTwiceTestCase.testInvocations); } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExecuteTestsTwiceExtension.class) static class ExecuteTestsTwiceTestCase { static int testInvocations = 0; + @SuppressWarnings("JUnitMalformedDeclaration") @Test void testWithResolvedParameter(TestInfo testInfo, @ExtendWith(ExtensionContextParameterResolver.class) ExtensionContext extensionContext) { @@ -54,6 +56,7 @@ void testWithResolvedParameter(TestInfo testInfo, } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExecuteConstructorTwiceExtension.class) static class ExecuteConstructorTwiceTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeAllAndAfterAllComposedAnnotationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeAllAndAfterAllComposedAnnotationTests.java index 1176fea22381..e62ea2d5cb27 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeAllAndAfterAllComposedAnnotationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeAllAndAfterAllComposedAnnotationTests.java @@ -39,6 +39,7 @@ void beforeAllAndAfterAllAsMetaAnnotations() { assertThat(methodsInvoked).containsExactly("beforeAll", "test", "afterAll"); } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase { @CustomBeforeAll diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeEachAndAfterEachComposedAnnotationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeEachAndAfterEachComposedAnnotationTests.java index 60091c7ae4a8..c9338fb40861 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeEachAndAfterEachComposedAnnotationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeEachAndAfterEachComposedAnnotationTests.java @@ -39,6 +39,7 @@ void beforeEachAndAfterEachAsMetaAnnotations() { assertThat(methodsInvoked).containsExactly("beforeEach", "test", "afterEach"); } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase { @CustomBeforeEach diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultExecutionModeTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultExecutionModeTests.java index aae9b97c1bc2..e116f4668472 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultExecutionModeTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultExecutionModeTests.java @@ -126,6 +126,7 @@ private T firstChild(TestDescriptor engineDescriptor, .orElseGet(() -> fail("No child of type " + testDescriptorClass + " found")); } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase { @Test @@ -155,6 +156,7 @@ static class ConcurrentTestCase extends TestCase { static class SameThreadTestCase extends TestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") static class OuterTestCase { @Nested class LevelOne { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultMethodTests.java index 7fb690877718..b548e26def2c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultMethodTests.java @@ -200,6 +200,7 @@ default void afterAll() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class GenericTestCaseWithDefaultMethod implements GenericTestInterface { @Test @@ -210,6 +211,7 @@ void test(Double number) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class GenericTestCaseWithOverriddenDefaultMethod implements GenericTestInterface { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DisabledTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DisabledTests.java index 62217371196b..d9af4d65202c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DisabledTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DisabledTests.java @@ -50,6 +50,7 @@ void executeTestsWithDisabledTestMethods() throws Exception { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @Disabled static class DisabledTestClassTestCase { @@ -59,6 +60,7 @@ void disabledTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class DisabledTestMethodsTestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ExceptionHandlingTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ExceptionHandlingTests.java index 80e730fa8566..e039e37e448f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ExceptionHandlingTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ExceptionHandlingTests.java @@ -248,6 +248,7 @@ void cleanUpExceptions() { // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class FailureTestCase { static Optional exceptionToThrowInBeforeAll = Optional.empty(); @@ -309,6 +310,7 @@ void abortedTest() { } + @SuppressWarnings("JUnitMalformedDeclaration") @TestInstance(PER_METHOD) @ExtendWith(ThrowingAfterAllCallback.class) static class TestCaseWithInvalidConstructorAndThrowingAfterAllCallbackAndPerMethodLifecycle { @@ -322,6 +324,7 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") @TestInstance(PER_CLASS) @ExtendWith(ThrowingAfterAllCallback.class) static class TestCaseWithInvalidConstructorAndThrowingAfterAllCallbackAndPerClassLifecycle { @@ -334,6 +337,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ThrowingBeforeAllCallback.class) @ExtendWith(ThrowingAfterAllCallback.class) static class TestCaseWithThrowingBeforeAllAndAfterAllCallbacks { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/FailedAssumptionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/FailedAssumptionsTests.java index be2d03755a6c..8aec67537576 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/FailedAssumptionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/FailedAssumptionsTests.java @@ -42,6 +42,7 @@ void assumptionViolatedExceptionInBeforeAll() { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class TestAbortedExceptionInBeforeAllTestCase { @BeforeAll @@ -54,6 +55,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class AssumptionViolatedExceptionInBeforeAllTestCase { @BeforeAll diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/InvalidLifecycleMethodConfigurationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/InvalidLifecycleMethodConfigurationTests.java index a7efbed7e73a..461c24c3a779 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/InvalidLifecycleMethodConfigurationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/InvalidLifecycleMethodConfigurationTests.java @@ -73,6 +73,7 @@ private void assertContainerFailed(Class invalidTestClass) { // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase { @Test @@ -80,9 +81,11 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithInvalidNonStaticBeforeAllMethod { // must be static + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeAll void beforeAll() { } @@ -92,9 +95,11 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithInvalidNonStaticAfterAllMethod { // must be static + @SuppressWarnings("JUnitMalformedDeclaration") @AfterAll void afterAll() { } @@ -104,9 +109,11 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithInvalidStaticBeforeEachMethod { // must NOT be static + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeEach static void beforeEach() { } @@ -116,9 +123,11 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithInvalidStaticAfterEachMethod { // must NOT be static + @SuppressWarnings("JUnitMalformedDeclaration") @AfterEach static void afterEach() { } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/MultipleTestableAnnotationsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/MultipleTestableAnnotationsTests.java index fd841d06e23e..713f56d52ca7 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/MultipleTestableAnnotationsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/MultipleTestableAnnotationsTests.java @@ -42,8 +42,10 @@ void testAndRepeatedTest(@TrackLogRecords LogRecordListener listener) { // @formatter:on } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @Test @RepeatedTest(1) void testAndRepeatedTest(RepetitionInfo repetitionInfo) { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedTestClassesTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedTestClassesTests.java index 2fa1b21f524f..72650a841dec 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedTestClassesTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedTestClassesTests.java @@ -190,6 +190,7 @@ private void assertNestedCycle(Class start, Class from, Class to) { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithNesting { @Test @@ -210,6 +211,7 @@ void failing() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithDoubleNesting { static int beforeTopCount = 0; @@ -283,6 +285,7 @@ void failing() { interface InterfaceWithNestedClass { + @SuppressWarnings("JUnitMalformedDeclaration") @Nested class NestedInInterface { @@ -334,6 +337,7 @@ class ConcreteInner2 extends AbstractSuperClass { static class AbstractOuterClass { } + @SuppressWarnings("JUnitMalformedDeclaration") static class OuterClass extends AbstractOuterClass { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/NonVoidTestableMethodIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/NonVoidTestableMethodIntegrationTests.java index abc364ea5147..b3694440c4f0 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/NonVoidTestableMethodIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/NonVoidTestableMethodIntegrationTests.java @@ -21,12 +21,14 @@ class NonVoidTestableMethodIntegrationTests { void valid() { } + @SuppressWarnings("JUnitMalformedDeclaration") @Test int invalidMethodReturningPrimitive() { fail("This method should never have been called."); return 1; } + @SuppressWarnings("JUnitMalformedDeclaration") @Test String invalidMethodReturningObject() { fail("This method should never have been called."); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/OverloadedTestMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/OverloadedTestMethodTests.java index 5aa8eab7bbf2..bcd5d5f8fed3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/OverloadedTestMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/OverloadedTestMethodTests.java @@ -64,6 +64,7 @@ void executeTestCaseWithOverloadedMethodsWithSingleMethodThatAcceptsArgumentsSel assertTrue(first.isPresent()); } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/RecordTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/RecordTests.java index 43930deffd6f..a42187591b72 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/RecordTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/RecordTests.java @@ -23,6 +23,7 @@ void recordsAreTestClasses() { .assertStatistics(stats -> stats.finished(2).succeeded(1).failed(1)); } + @SuppressWarnings("JUnitMalformedDeclaration") record TestCase() { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java index 0e19f0466f16..534cb625f481 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java @@ -36,6 +36,7 @@ void reportEntriesArePublished() { .reportingEntryPublished(7)); } + @SuppressWarnings("JUnitMalformedDeclaration") static class MyReportingTestCase { @BeforeEach diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/StandardTestClassTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/StandardTestClassTests.java index 3782fe7a9d5e..a5d1b6bfb6a2 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/StandardTestClassTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/StandardTestClassTests.java @@ -118,6 +118,7 @@ void testsFailWhenAfterEachFails() { assertTrue(TestCaseWithFailingAfter.testExecuted, "test executed?"); } + @SuppressWarnings("JUnitMalformedDeclaration") static class MyStandardTestCase { static int countBefore1 = 0; @@ -175,6 +176,7 @@ void testAbortedJUnit4Legacy() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class FirstOfTwoTestCases { @Test @@ -194,6 +196,7 @@ void failingTest() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class SecondOfTwoTestCases { @Test @@ -213,6 +216,7 @@ void succeedingTest3() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithFailingBefore { static int countBefore = 0; @@ -233,6 +237,7 @@ void test2() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithFailingAfter { static boolean testExecuted = false; diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/StaticNestedBeforeAllAndAfterAllMethodsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/StaticNestedBeforeAllAndAfterAllMethodsTests.java index 16549a1c4c1a..431830a6495f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/StaticNestedBeforeAllAndAfterAllMethodsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/StaticNestedBeforeAllAndAfterAllMethodsTests.java @@ -49,6 +49,7 @@ void staticBeforeAllAndAfterAllMethodsInNestedTestClass() { ); } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase { @BeforeAll diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestClassInheritanceTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestClassInheritanceTests.java index 7768b76a49df..aed5b3eaa969 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestClassInheritanceTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestClassInheritanceTests.java @@ -157,6 +157,7 @@ void superTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class LocalTestCase extends AbstractTestCase { boolean throwExceptionInAfterMethod = false; @@ -252,6 +253,7 @@ static void afterAll2() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase3 extends TestCase2 { @BeforeAll diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleConfigurationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleConfigurationTests.java index e800c3fede1c..740807fbf0e3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleConfigurationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleConfigurationTests.java @@ -143,6 +143,7 @@ private void performAssertions(Class testClass, Map configPar // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @TestInstance(PER_METHOD) static class ExplicitInstancePerTestMethodTestCase { @@ -168,6 +169,7 @@ static void afterAllStatic() { * {@code @AfterAll} methods are static, even though there is no explicit * {@code @TestInstance} declaration. */ + @SuppressWarnings("JUnitMalformedDeclaration") static class AssumedInstancePerTestMethodTestCase { @BeforeAll @@ -187,6 +189,7 @@ static void afterAllStatic() { } + @SuppressWarnings("JUnitMalformedDeclaration") @TestInstance(PER_CLASS) static class ExplicitInstancePerClassTestCase { @@ -212,8 +215,10 @@ void afterAll(TestInfo testInfo) { * {@code @AfterAll} methods are non-static, even though there is no * explicit {@code @TestInstance} declaration. */ + @SuppressWarnings("JUnitMalformedDeclaration") static class AssumedInstancePerClassTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeAll void beforeAll(TestInfo testInfo) { methodsInvoked.add("beforeAll"); @@ -224,6 +229,7 @@ void test() { methodsInvoked.add("test"); } + @SuppressWarnings("JUnitMalformedDeclaration") @AfterAll void afterAll(TestInfo testInfo) { methodsInvoked.add("afterAll"); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java index 6358c0ad9ba3..a80c660b9a69 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java @@ -677,6 +677,7 @@ private static String concat(String... args) { // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(InstanceTrackingExtension.class) // The following is commented out b/c it's the default. // @TestInstance(Lifecycle.PER_METHOD) @@ -752,6 +753,7 @@ static class SubInstancePerClassTestCase extends InstancePerClassTestCase { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(InstanceTrackingExtension.class) // The following is commented out b/c it's the default. // @TestInstance(Lifecycle.PER_METHOD) @@ -817,6 +819,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(InstanceTrackingExtension.class) @TestInstance(Lifecycle.PER_CLASS) static class InstancePerClassOuterTestCase { @@ -892,6 +895,7 @@ void afterAll(TestInfo testInfo) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(InstanceTrackingExtension.class) // The following is commented out b/c it's the default. // @TestInstance(Lifecycle.PER_METHOD) diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/DisplayNameUtilsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/DisplayNameUtilsTests.java index 905747468b45..1bd74fd21f55 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/DisplayNameUtilsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/DisplayNameUtilsTests.java @@ -216,6 +216,7 @@ static class NotDisplayNameTestCase { class NestedTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayNameGeneration(value = NullDisplayNameGenerator.class) static class NullDisplayNameTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptorTests.java index b96a1d3b5bf9..f2f07aca4548 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptorTests.java @@ -295,7 +295,7 @@ private static abstract class AbstractTestCase { @Tag("classTag1") @Tag("classTag2") @DisplayName("custom class name") - @SuppressWarnings("unused") + @SuppressWarnings({ "unused", "JUnitMalformedDeclaration" }) private static class TestCase extends AbstractTestCase { void test() { @@ -330,9 +330,11 @@ void customTestAnnotation() { } + @SuppressWarnings("JUnitMalformedDeclaration") private static class TestCaseWithInvalidBeforeAllMethod { // must be static + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeAll void beforeAll() { } @@ -343,9 +345,11 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") private static class TestCaseWithInvalidAfterAllMethod { // must be static + @SuppressWarnings("JUnitMalformedDeclaration") @AfterAll void afterAll() { } @@ -356,9 +360,11 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") private static class TestCaseWithInvalidBeforeEachMethod { // must NOT be static + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeEach static void beforeEach() { } @@ -369,9 +375,11 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") private static class TestCaseWithInvalidAfterEachMethod { // must NOT be static + @SuppressWarnings("JUnitMalformedDeclaration") @AfterEach static void afterEach() { } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtilsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtilsTests.java index 8ac3a007347a..9705c1fa162f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtilsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtilsTests.java @@ -137,6 +137,7 @@ private static List namesOf(List methods) { class TestCaseWithStandardLifecycle { + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeAll void one() { } @@ -157,10 +158,12 @@ void eleven() { void twelve() { } + @SuppressWarnings("JUnitMalformedDeclaration") @AfterAll void five() { } + @SuppressWarnings("JUnitMalformedDeclaration") @AfterAll void six() { } @@ -190,21 +193,25 @@ void eight() { class TestCaseWithNonVoidLifecyleMethods { + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeEach String aa() { return null; } + @SuppressWarnings("JUnitMalformedDeclaration") @AfterEach int bb() { return 1; } + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeAll Double cc() { return null; } + @SuppressWarnings("JUnitMalformedDeclaration") @AfterAll String dd() { return ""; diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/ClassWithStaticInnerTestCases.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/ClassWithStaticInnerTestCases.java index 0090eb336fcc..4f5b578f3124 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/ClassWithStaticInnerTestCases.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/ClassWithStaticInnerTestCases.java @@ -17,6 +17,7 @@ */ public class ClassWithStaticInnerTestCases { + @SuppressWarnings("JUnitMalformedDeclaration") public static class ShouldBeDiscovered { @Test @@ -24,7 +25,7 @@ void test1() { } } - @SuppressWarnings("unused") + @SuppressWarnings({ "unused", "JUnitMalformedDeclaration" }) private static class ShouldNotBeDiscovered { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java index 4f2fb79dbf24..3e81ce9a98c9 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java @@ -834,6 +834,7 @@ void test4() { class HerTestClass extends MyTestClass { + @SuppressWarnings("JUnitMalformedDeclaration") @Test void test7(String param) { } @@ -841,6 +842,7 @@ void test7(String param) { class OtherTestClass { + @SuppressWarnings("JUnitMalformedDeclaration") static class NestedTestClass { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoveryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoveryTests.java index 87bbafe2485e..3916735e44ec 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoveryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoveryTests.java @@ -170,6 +170,7 @@ void abstractTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class LocalTestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClassTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClassTests.java index 434a105131fc..37133ca9587e 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClassTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClassTests.java @@ -45,10 +45,12 @@ private static class NestedClassesTestCase { class InnerClass { } + @SuppressWarnings("JUnitMalformedDeclaration") @Nested static class StaticNestedClass { } + @SuppressWarnings("JUnitMalformedDeclaration") @Nested private class PrivateInnerClass { } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTestsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTestsTests.java index d3bea9a00710..f92921c82932 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTestsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTestsTests.java @@ -95,6 +95,7 @@ void recursiveHierarchies() { // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") private class PrivateClassWithTestMethod { @Test @@ -138,6 +139,7 @@ void second() { // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class StaticTestCase { @Test @@ -145,6 +147,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") private static class PrivateStaticTestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethodTests.java index a3a6c6e2b8f5..0865ef4889ed 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethodTests.java @@ -101,26 +101,32 @@ private static abstract class AbstractClassWithAbstractTestMethod { } + @SuppressWarnings("JUnitMalformedDeclaration") private static class ClassWithTestMethods { + @SuppressWarnings("JUnitMalformedDeclaration") @Test static void bogusStaticTestMethod() { } + @SuppressWarnings("JUnitMalformedDeclaration") @Test private void bogusPrivateTestMethod() { } + @SuppressWarnings("JUnitMalformedDeclaration") @Test String bogusTestMethodReturningObject() { return ""; } + @SuppressWarnings("JUnitMalformedDeclaration") @Test Void bogusTestMethodReturningVoidReference() { return null; } + @SuppressWarnings("JUnitMalformedDeclaration") @Test int bogusTestMethodReturningPrimitive() { return 0; diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/UniqueIdParsingForArrayParameterIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/UniqueIdParsingForArrayParameterIntegrationTests.java index bae7f2e80be4..7f5dde7869f2 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/UniqueIdParsingForArrayParameterIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/UniqueIdParsingForArrayParameterIntegrationTests.java @@ -55,6 +55,7 @@ void executeTestsForPrimitiveArrayMethodInjectionCases() { assertThat(UniqueId.parse(uniqueId.toString())).isEqualTo(uniqueId); } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(PrimitiveArrayParameterResolver.class) static class PrimitiveArrayMethodInjectionTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/AutoCloseTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/AutoCloseTests.java index 5c66a2ac0842..1b4c4c5bf17c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/AutoCloseTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/AutoCloseTests.java @@ -457,6 +457,7 @@ static class CloseMethodMustBeInvokedViaInterfaceTestCase implements TestInterfa } @TestInstance(PER_METHOD) + @SuppressWarnings("JUnitMalformedDeclaration") static class InstancePerMethodTestCase { @AutoClose @@ -489,6 +490,7 @@ void test2() { } @TestInstance(PER_CLASS) + @SuppressWarnings("JUnitMalformedDeclaration") static class InstancePerClassTestCase { static boolean closed = false; @@ -569,6 +571,7 @@ static void setup() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class SuperTestCase { @AutoClose @@ -589,6 +592,7 @@ void superTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class SubTestCase extends SuperTestCase { @AutoClose @@ -607,6 +611,7 @@ void subTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class FailingFieldsTestCase { @AutoClose @@ -639,6 +644,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class FailingFieldsEnclosingTestCase { @AutoClose diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterAllTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterAllTests.java index 34c178c045e8..c3f98cb7ec4a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterAllTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterAllTests.java @@ -187,6 +187,7 @@ private void assertBeforeAllAndAfterAllCallbacks(Class testClass, int testsSt // ------------------------------------------------------------------------- // Must NOT be private; otherwise, the @Test method gets discovered but never executed. + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooClassLevelCallbacks.class, BarClassLevelCallbacks.class }) static class TopLevelTestCase { @@ -207,6 +208,7 @@ void test() { } // Must NOT be private; otherwise, the @Test method gets discovered but never executed. + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(BazClassLevelCallbacks.class) static class SecondLevelTestCase extends TopLevelTestCase { @@ -227,6 +229,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(QuuxClassLevelCallbacks.class) static class ThirdLevelTestCase extends SecondLevelTestCase { @@ -247,6 +250,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(QuuxClassLevelCallbacks.class) static class ThirdLevelStaticHidingTestCase extends SecondLevelTestCase { @@ -287,6 +291,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooClassLevelCallbacks.class) static class ExceptionInBeforeAllMethodTestCase { @@ -307,6 +312,7 @@ static void afterAll() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooClassLevelCallbacks.class, ExceptionThrowingBeforeAllCallback.class }) static class ExceptionInBeforeAllCallbackTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterEachTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterEachTests.java index 8c7f59f7eda3..123b786e3d93 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterEachTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterEachTests.java @@ -288,6 +288,7 @@ void testMethodThrowsAnException() { static class ParentTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(BarMethodLevelCallbacks.class) static class ChildTestCase extends ParentTestCase { @@ -306,6 +307,7 @@ default void defaultTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(BarMethodLevelCallbacks.class) static class TestInterfaceTestCase implements TestInterface { @@ -315,6 +317,7 @@ void localTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooMethodLevelCallbacks.class, BarMethodLevelCallbacks.class }) static class OuterTestCase { @@ -354,6 +357,7 @@ void afterEachInnerMethod() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooMethodLevelCallbacks.class, ExceptionThrowingBeforeEachCallback.class, BarMethodLevelCallbacks.class }) static class ExceptionInBeforeEachCallbackTestCase { @@ -374,6 +378,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooMethodLevelCallbacks.class, ExceptionThrowingAfterEachCallback.class, BarMethodLevelCallbacks.class }) static class ExceptionInAfterEachCallbackTestCase { @@ -394,6 +399,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooMethodLevelCallbacks.class) static class ExceptionInBeforeEachMethodTestCase { @@ -421,6 +427,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooMethodLevelCallbacks.class) static class ExceptionInAfterEachMethodTestCase { @@ -441,6 +448,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooMethodLevelCallbacks.class) static class ExceptionInTestMethodTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterTestExecutionCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterTestExecutionCallbackTests.java index 89672560abba..b6cd2fb8df09 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterTestExecutionCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterTestExecutionCallbackTests.java @@ -256,6 +256,7 @@ void testMethodThrowsAnException() { static class ParentTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(BarTestExecutionCallbacks.class) static class ChildTestCase extends ParentTestCase { @@ -274,6 +275,7 @@ default void defaultTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(BarTestExecutionCallbacks.class) static class TestInterfaceTestCase implements TestInterface { @@ -283,6 +285,7 @@ void localTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooTestExecutionCallbacks.class, BarTestExecutionCallbacks.class }) static class OuterTestCase { @@ -322,6 +325,7 @@ void afterInnerMethod() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooTestExecutionCallbacks.class, ExceptionThrowingBeforeTestExecutionCallback.class, BarTestExecutionCallbacks.class }) static class ExceptionInBeforeTestExecutionCallbackTestCase { @@ -342,6 +346,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooTestExecutionCallbacks.class, ExceptionThrowingAfterTestExecutionCallback.class, BarTestExecutionCallbacks.class }) static class ExceptionInAfterTestExecutionCallbackTestCase { @@ -362,6 +367,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooTestExecutionCallbacks.class) static class ExceptionInBeforeEachMethodTestCase { @@ -382,6 +388,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooTestExecutionCallbacks.class) static class ExceptionInTestMethodTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExecutionConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExecutionConditionTests.java index b4c13b933d96..03005f9bd1df 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExecutionConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExecutionConditionTests.java @@ -151,6 +151,7 @@ private void assertExecutionConditionOverride(String deactivatePattern, int star // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @SystemProperty(key = FOO, value = BOGUS) @DeactivatedConditions static class TestCaseWithExecutionConditionOnClass { @@ -167,6 +168,7 @@ void atDisabledTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithExecutionConditionOnMethods { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionContextExecutionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionContextExecutionTests.java index 8d5694ce3071..3a6605bbc3af 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionContextExecutionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionContextExecutionTests.java @@ -53,6 +53,7 @@ void twoTestClassesCanShareStateViaEngineExtensionContext() { assertThat(Parent.counter).hasValue(1); } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(OnlyIncrementCounterOnce.class) static class Parent { static final AtomicInteger counter = new AtomicInteger(0); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/InvocationInterceptorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/InvocationInterceptorTests.java index 2dcc716ddc85..2557a8173236 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/InvocationInterceptorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/InvocationInterceptorTests.java @@ -60,6 +60,7 @@ void failsTestWhenInterceptorChainDoesNotCallInvocation() { message(it -> it.startsWith("Chain of InvocationInterceptors never called invocation"))))); } + @SuppressWarnings("JUnitMalformedDeclaration") static class InvocationIgnoringInterceptorTestCase { @RegisterExtension Extension interceptor = new InvocationInterceptor() { @@ -83,6 +84,7 @@ void successTestWhenInterceptorChainSkippedInvocation() { results.testEvents().assertStatistics(stats -> stats.failed(0).succeeded(1)); } + @SuppressWarnings("JUnitMalformedDeclaration") static class InvocationSkippedTestCase { @RegisterExtension Extension interceptor = new InvocationInterceptor() { @@ -109,6 +111,7 @@ void failsTestWhenInterceptorChainCallsInvocationMoreThanOnce() { "Chain of InvocationInterceptors called invocation multiple times instead of just once"))))); } + @SuppressWarnings("JUnitMalformedDeclaration") static class DoubleInvocationInterceptorTestCase { @RegisterExtension Extension interceptor = new InvocationInterceptor() { @@ -147,6 +150,7 @@ private Stream getEvents(EngineExecutionResults results, EnumSet map.values().stream()); } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooInvocationInterceptor.class, BarInvocationInterceptor.class, BazInvocationInterceptor.class }) static class TestCaseWithThreeInterceptors { @@ -154,6 +158,7 @@ public TestCaseWithThreeInterceptors(TestReporter reporter) { publish(reporter, InvocationType.CONSTRUCTOR); } + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeAll static void beforeAll(TestReporter reporter) { publish(reporter, InvocationType.BEFORE_ALL); @@ -187,6 +192,7 @@ void afterEach(TestReporter reporter) { publish(reporter, InvocationType.AFTER_EACH); } + @SuppressWarnings("JUnitMalformedDeclaration") @AfterAll static void afterAll(TestReporter reporter) { publish(reporter, InvocationType.AFTER_ALL); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/LifecycleMethodExecutionExceptionHandlerTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/LifecycleMethodExecutionExceptionHandlerTests.java index b204cc241f45..7bc8c447ba97 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/LifecycleMethodExecutionExceptionHandlerTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/LifecycleMethodExecutionExceptionHandlerTests.java @@ -297,6 +297,7 @@ private boolean executeThrowingOutOfMemoryException() { // ------------------------------------------ + @SuppressWarnings("JUnitMalformedDeclaration") static class BaseTestCase { @BeforeAll static void throwBeforeAll() { @@ -348,6 +349,7 @@ static class SwallowingTestCase extends BaseTestCase { static class UnrecoverableExceptionTestCase extends BaseTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ShouldNotBeCalledHandler.class) @ExtendWith(SwallowExceptionHandler.class) @ExtendWith(RethrowExceptionHandler.class) diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedMethodTests.java index 6291a7b4ecfa..eeeea87571e0 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedMethodTests.java @@ -337,6 +337,7 @@ private Events executeRandomTestCaseInParallelWithRandomSeed(String seed) { // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class BaseTestCase { @Test @@ -349,7 +350,7 @@ void c() { } - @SuppressWarnings("unused") + @SuppressWarnings({ "unused", "JUnitMalformedDeclaration" }) @TestMethodOrder(MethodName.class) static class MethodNameTestCase extends BaseTestCase { @@ -402,7 +403,7 @@ void zzz() { } } - @SuppressWarnings({ "deprecation", "unused" }) + @SuppressWarnings({ "deprecation", "unused", "JUnitMalformedDeclaration" }) @TestMethodOrder(org.junit.jupiter.api.MethodOrderer.Alphanumeric.class) static class AlphanumericTestCase extends BaseTestCase { @@ -455,6 +456,7 @@ void zzz() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(MethodOrderer.DisplayName.class) static class DisplayNameTestCase { @@ -527,6 +529,7 @@ void No_display_name_attribute_2_caps() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(OrderAnnotation.class) static class OrderAnnotationTestCase { @@ -594,6 +597,7 @@ class NestedOrderAnnotationTestCase extends OrderAnnotationTestCase { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(Random.class) static class RandomTestCase { @@ -626,6 +630,7 @@ void test5() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(MisbehavingByAdding.class) static class MisbehavingByAddingTestCase { @@ -643,6 +648,7 @@ void test2() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(MisbehavingByRemoving.class) static class MisbehavingByRemovingTestCase { @@ -712,6 +718,7 @@ public void orderMethods(MethodOrdererContext context) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class WithoutTestMethodOrderTestCase { @BeforeEach diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedProgrammaticExtensionRegistrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedProgrammaticExtensionRegistrationTests.java index 126f662d47ef..c9f451ed4e2b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedProgrammaticExtensionRegistrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedProgrammaticExtensionRegistrationTests.java @@ -200,6 +200,7 @@ private void assertOutcome(Class testClass, String... values) { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") private static class AbstractTestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ParameterResolverTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ParameterResolverTests.java index 5aa8f1205d64..87919d8a087f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ParameterResolverTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ParameterResolverTests.java @@ -243,6 +243,7 @@ private void assertEventsForParameterizedTypes(EngineExecutionResults executionR // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(CustomTypeParameterResolver.class) static class ConstructorInjectionTestCase { @@ -281,6 +282,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(CustomAnnotationParameterResolver.class) static class AnnotatedParameterConstructorInjectionTestCase { @@ -320,6 +322,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ CustomTypeParameterResolver.class, CustomAnnotationParameterResolver.class }) static class MethodInjectionTestCase { @@ -362,6 +365,7 @@ void overloadedName(CustomType customType, @CustomAnnotation String value) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(NullIntegerParameterResolver.class) static class NullMethodInjectionTestCase { @@ -376,6 +380,7 @@ void injectPrimitive(int number) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(PrimitiveIntegerParameterResolver.class) static class PrimitiveIntegerMethodInjectionTestCase { @@ -385,6 +390,7 @@ void intPrimitive(int i) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(PrimitiveArrayParameterResolver.class) static class PrimitiveArrayMethodInjectionTestCase { @@ -394,6 +400,7 @@ void primitiveArray(int... ints) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(NumberParameterResolver.class) static class PotentiallyIncompatibleTypeMethodInjectionTestCase { @@ -417,6 +424,7 @@ void doubleParameterInjection(Double number) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class BeforeAndAfterMethodInjectionTestCase { @BeforeEach @@ -435,6 +443,7 @@ void after(TestInfo testInfo) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("custom class name") static class BeforeAndAfterAllMethodInjectionTestCase { @@ -453,6 +462,7 @@ static void afterAll(TestInfo testInfo) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class ExtendWithOnMethodTestCase { /** @@ -463,6 +473,7 @@ static class ExtendWithOnMethodTestCase { * * @see #523 */ + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeEach @AfterEach void setUpAndTearDown(CustomType customType, @CustomAnnotation String value) { @@ -479,6 +490,7 @@ void testMethodWithExtensionAnnotation(CustomType customType, @CustomAnnotation } } + @SuppressWarnings("JUnitMalformedDeclaration") static class ParameterizedTypeTestCase { @Test @@ -489,6 +501,7 @@ void testMapOfStrings(Map map) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TypeBasedParameterResolverTestCase { @Test @ExtendWith(MapOfListsTypeBasedParameterResolver.class) diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java index 2a55678fa219..ac2f02350a66 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java @@ -299,6 +299,7 @@ private static void assertWisdom(CrystalBall crystalBall, String wisdom, String assertEquals("Outlook good", wisdom, useCase); } + @SuppressWarnings("JUnitMalformedDeclaration") static class InstanceLevelExtensionRegistrationTestCase { @RegisterExtension @@ -321,6 +322,7 @@ void afterEach(String wisdom) { } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExtensionInjector.class) static class InstanceLevelExtensionRegistrationWithInjectedExtensionTestCase { @@ -344,6 +346,7 @@ void afterEach(String wisdom) { } + @SuppressWarnings("JUnitMalformedDeclaration") @TestInstance(PER_CLASS) static class InstanceLevelExtensionRegistrationWithTestInstancePerClassLifecycleTestCase { @@ -377,6 +380,7 @@ void afterAll(String wisdom) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class ClassLevelExtensionRegistrationTestCase { @RegisterExtension @@ -409,8 +413,10 @@ static void afterAll(String wisdom) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class SubClassLevelExtensionRegistrationTestCase extends ClassLevelExtensionRegistrationTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @Test @Override void test(String wisdom) { @@ -446,8 +452,10 @@ static void afterAll(String wisdom) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class ExtensionRegistrationFromInterfaceTestCase implements ClassLevelExtensionRegistrationInterface { + @SuppressWarnings("JUnitMalformedDeclaration") @Test void test(String wisdom) { assertWisdom(crystalBall, wisdom, "@Test"); @@ -475,6 +483,7 @@ public Object resolveParameter(ParameterContext parameterContext, ExtensionConte } + @SuppressWarnings("JUnitMalformedDeclaration") static class ClassLevelExtensionRegistrationParentTestCase { @RegisterExtension @@ -500,6 +509,7 @@ static class ClassLevelExtensionRegistrationChildTestCase extends ClassLevelExte } + @SuppressWarnings("JUnitMalformedDeclaration") static class InstanceLevelExtensionRegistrationParentTestCase { @RegisterExtension @@ -564,8 +574,10 @@ public void beforeEach(ExtensionContext context) throws Exception { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class InstanceLevelCustomExtensionApiTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @RegisterExtension CustomExtension extension = new CustomExtensionImpl(); @@ -576,8 +588,10 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class ClassLevelCustomExtensionApiTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @RegisterExtension static CustomExtension extension = new CustomExtensionImpl(); @@ -588,6 +602,7 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class AbstractTestCase { @Test @@ -598,6 +613,7 @@ void test() { static class InstanceLevelExtensionRegistrationWithPrivateFieldTestCase extends AbstractTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @RegisterExtension private Extension extension = new Extension() { }; @@ -606,6 +622,7 @@ static class InstanceLevelExtensionRegistrationWithPrivateFieldTestCase extends static class ClassLevelExtensionRegistrationWithPrivateFieldTestCase extends AbstractTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @RegisterExtension private static Extension extension = new Extension() { }; @@ -628,6 +645,7 @@ static class ClassLevelExtensionRegistrationWithNullFieldTestCase extends Abstra static class InstanceLevelExtensionRegistrationWithNonExtensionFieldValueTestCase extends AbstractTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @RegisterExtension Object extension = "not an extension type"; @@ -635,6 +653,7 @@ static class InstanceLevelExtensionRegistrationWithNonExtensionFieldValueTestCas static class ClassLevelExtensionRegistrationWithNonExtensionFieldValueTestCase extends AbstractTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @RegisterExtension static Object extension = "not an extension type"; @@ -727,11 +746,13 @@ static class TwoNestedClassesTestCase { @Nested class A { + @SuppressWarnings("JUnitMalformedDeclaration") @Test void first(Long n) { assertEquals(42L, n); } + @SuppressWarnings("JUnitMalformedDeclaration") @Test void second(Long n) { assertEquals(42L, n); @@ -742,11 +763,13 @@ void second(Long n) { @Nested class B { + @SuppressWarnings("JUnitMalformedDeclaration") @Test void first(Long n) { assertEquals(42L, n); } + @SuppressWarnings("JUnitMalformedDeclaration") @Test void second(Long n) { assertEquals(42L, n); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java index b851b1f98f0b..df7b9f309014 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java @@ -331,10 +331,12 @@ void testWithEmptyPattern() { void testWithBlankPattern() { } + @SuppressWarnings("JUnitMalformedDeclaration") @RepeatedTest(-99) void negativeRepeatCount() { } + @SuppressWarnings("JUnitMalformedDeclaration") @RepeatedTest(0) void zeroRepeatCount() { } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryCleanupTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryCleanupTests.java index ff7644a015b2..95f1c19eb285 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryCleanupTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryCleanupTests.java @@ -192,6 +192,7 @@ static void deleteIfNotNullAndExists(Path dir) throws IOException { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class DefaultFieldCase { @TempDir @@ -203,6 +204,7 @@ void testDefaultField() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class NeverFieldCase { @TempDir(cleanup = NEVER) @@ -214,6 +216,7 @@ void testNeverField() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class AlwaysFieldCase { @TempDir(cleanup = ALWAYS) @@ -225,6 +228,7 @@ void testAlwaysField() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class OnSuccessPassingFieldCase { @TempDir(cleanup = ON_SUCCESS) @@ -236,6 +240,7 @@ void testOnSuccessPassingField() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class OnSuccessFailingFieldCase { @TempDir(cleanup = ON_SUCCESS) @@ -248,6 +253,7 @@ void testOnSuccessFailingField() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(MethodOrderer.OrderAnnotation.class) static class OnSuccessFailingStaticFieldCase { @@ -398,6 +404,7 @@ static void afterAll() throws IOException { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class DefaultParameterCase { @Test @@ -406,6 +413,7 @@ void testDefaultParameter(@TempDir Path defaultParameterDir) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class NeverParameterCase { @Test @@ -414,6 +422,7 @@ void testNeverParameter(@TempDir(cleanup = NEVER) Path neverParameterDir) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class AlwaysParameterCase { @Test @@ -422,6 +431,7 @@ void testAlwaysParameter(@TempDir(cleanup = ALWAYS) Path alwaysParameterDir) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class OnSuccessPassingParameterCase { @Test @@ -430,6 +440,7 @@ void testOnSuccessPassingParameter(@TempDir(cleanup = ON_SUCCESS) Path onSuccess } } + @SuppressWarnings("JUnitMalformedDeclaration") static class OnSuccessFailingParameterCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryMetaAnnotationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryMetaAnnotationTests.java index 905672bfbec5..a156270e356f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryMetaAnnotationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryMetaAnnotationTests.java @@ -44,6 +44,7 @@ void annotationOnParameter() { .assertStatistics(stats -> stats.started(1).succeeded(1)); } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnFieldTestCase { @CustomTempDir @@ -56,6 +57,7 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnParameterTestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerContextTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerContextTests.java index ee61717f56be..07202e36696a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerContextTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerContextTests.java @@ -513,6 +513,7 @@ private void assertResolvesSeparateTempDirs(Class testClass, Deque temp // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class BaseSharedTempDirFieldInjectionTestCase { static Path staticTempDir; @@ -613,6 +614,7 @@ static class AnnotationOnInstanceFieldAndBeforeAllMethodParameterWithTestInstanc } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnPrivateInstanceFieldTestCase { @SuppressWarnings("unused") @@ -626,6 +628,7 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnPrivateStaticFieldTestCase { @SuppressWarnings("unused") @@ -639,6 +642,7 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnStaticFieldWithUnsupportedTypeTestCase { @SuppressWarnings("unused") @@ -651,6 +655,7 @@ void test1() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnInstanceFieldWithUnsupportedTypeTestCase { @SuppressWarnings("unused") @@ -663,6 +668,7 @@ void test1() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class BaseSharedTempDirParameterInjectionTestCase { static Path tempDir; @@ -696,6 +702,7 @@ static void check(Path tempDir) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class BaseConstructorInjectionTestCase { static final Deque tempDirs = new LinkedList<>(); @@ -767,6 +774,7 @@ void beforeEach(@TempDir Path tempDir) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class NonDefaultFactoryTestCase { @Test @@ -785,6 +793,7 @@ public Path createTempDirectory(AnnotatedElementContext elementContext, Extensio } + @SuppressWarnings("JUnitMalformedDeclaration") static class StandardDefaultFactoryTestCase { @Test @@ -794,6 +803,7 @@ void test(@TempDir Path tempDir1, @TempDir Path tempDir2) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class CustomDefaultFactoryTestCase { @Test @@ -803,6 +813,7 @@ void test(@TempDir Path tempDir1, @TempDir Path tempDir2) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class CustomDefaultFactoryNotReturningDirectoryTestCase { @Test @@ -834,6 +845,7 @@ void beforeAll(@TempDir Path tempDir) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnAfterAllMethodParameterTestCase { static Path firstTempDir = null; @@ -854,6 +866,7 @@ static void afterAll(@TempDir Path tempDir) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class BaseSeparateTempDirsFieldInjectionTestCase { static final Deque tempDirs = new LinkedList<>(); @@ -907,6 +920,7 @@ static class SeparateTempDirsWhenUsedOnForEachLifecycleMethodsWithTestInstancePe extends SeparateTempDirsWhenUsedOnForEachLifecycleMethodsFieldInjectionTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") static class BaseSeparateTempDirsParameterInjectionTestCase { static final Deque tempDirs = new LinkedList<>(); @@ -953,6 +967,7 @@ static class SeparateTempDirsWhenUsedOnForEachLifecycleMethodsWithTestInstancePe extends SeparateTempDirsWhenUsedOnForEachLifecycleMethodsParameterInjectionTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") static class InvalidTestCase { @Test @@ -961,6 +976,7 @@ void wrongParameterType(@SuppressWarnings("unused") @TempDir String ignored) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class FileInjectionTestCase { @TempDir @@ -989,6 +1005,7 @@ private static void writeFile(Path tempDir, TestInfo testInfo) throws IOExceptio } // https://github.com/junit-team/junit5/issues/1748 + @SuppressWarnings("JUnitMalformedDeclaration") static class TempDirectoryDoesNotPreventConstructorParameterResolutionTestCase { TempDirectoryDoesNotPreventConstructorParameterResolutionTestCase(TestInfo testInfo) { @@ -1002,6 +1019,7 @@ void test() { } // https://github.com/junit-team/junit5/issues/1801 + @SuppressWarnings("JUnitMalformedDeclaration") static class UserTempDirectoryDeletionDoesNotCauseFailureTestCase { @Test @@ -1013,6 +1031,7 @@ void deleteTempDir(@TempDir Path tempDir) throws IOException { } // https://github.com/junit-team/junit5/issues/2046 + @SuppressWarnings("JUnitMalformedDeclaration") static class NonWritableFileDoesNotCauseFailureTestCase { @Test @@ -1027,6 +1046,7 @@ void createReadonlyFile(@TempDir Path tempDir) throws IOException { } // https://github.com/junit-team/junit5/issues/2171 + @SuppressWarnings("JUnitMalformedDeclaration") static class ReadOnlyFileInReadOnlyDirDoesNotCauseFailureTestCase { @Test @@ -1040,6 +1060,7 @@ void createReadOnlyFileInReadOnlyDir(@TempDir File tempDir) throws IOException { } // https://github.com/junit-team/junit5/issues/2171 + @SuppressWarnings("JUnitMalformedDeclaration") static class ReadOnlyFileInDirInReadOnlyDirDoesNotCauseFailureTestCase { @Test @@ -1064,7 +1085,7 @@ private static boolean makeReadOnly(File file) throws IOException { } // https://github.com/junit-team/junit5/issues/2609 - @SuppressWarnings("ResultOfMethodCallIgnored") + @SuppressWarnings({ "ResultOfMethodCallIgnored", "JUnitMalformedDeclaration" }) static class NonMintPermissionContentInTempDirectoryDoesNotCauseFailureTestCase { @Test @@ -1443,6 +1464,7 @@ void makeTempDirectoryWithNonEmptyFolderContainingNonReadableFileNonExecutable(@ } // https://github.com/junit-team/junit5/issues/2079 + @SuppressWarnings("JUnitMalformedDeclaration") static class TempDirUsageInsideNestedClassesTestCase { @TempDir @@ -1475,6 +1497,7 @@ void deeplyNested() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class StaticTempDirUsageInsideNestedClassTestCase { @TempDir diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerDeclarationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerDeclarationTests.java index 33ba07a362d4..5414e18a5af3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerDeclarationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerDeclarationTests.java @@ -516,6 +516,7 @@ private static void assertSingleFailedTest(EngineExecutionResults results, Condi // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnPrivateInstanceFieldTestCase { @SuppressWarnings("unused") @@ -529,6 +530,7 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnPrivateStaticFieldTestCase { @SuppressWarnings("unused") @@ -542,6 +544,7 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnStaticFieldWithUnsupportedTypeTestCase { @SuppressWarnings("unused") @@ -554,6 +557,7 @@ void test1() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnInstanceFieldWithUnsupportedTypeTestCase { @SuppressWarnings("unused") @@ -566,6 +570,7 @@ void test1() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class InvalidTestCase { @Test @@ -600,6 +605,7 @@ private static void assertFileAndPathAreNotEqual(File tempDir, Path ref) { } // https://github.com/junit-team/junit5/issues/1748 + @SuppressWarnings("JUnitMalformedDeclaration") static class TempDirectoryDoesNotPreventConstructorParameterResolutionTestCase { @TempDir @@ -617,6 +623,7 @@ void test() { } // https://github.com/junit-team/junit5/issues/1801 + @SuppressWarnings("JUnitMalformedDeclaration") static class UserTempDirectoryDeletionDoesNotCauseFailureTestCase { @Test @@ -628,6 +635,7 @@ void deleteTempDir(@TempDir Path tempDir) throws IOException { } // https://github.com/junit-team/junit5/issues/2046 + @SuppressWarnings("JUnitMalformedDeclaration") static class NonWritableFileDoesNotCauseFailureTestCase { @Test @@ -642,6 +650,7 @@ void createReadonlyFile(@TempDir Path tempDir) throws IOException { } // https://github.com/junit-team/junit5/issues/2171 + @SuppressWarnings("JUnitMalformedDeclaration") static class ReadOnlyFileInReadOnlyDirDoesNotCauseFailureTestCase { @Test @@ -655,6 +664,7 @@ void createReadOnlyFileInReadOnlyDir(@TempDir File tempDir) throws IOException { } // https://github.com/junit-team/junit5/issues/2171 + @SuppressWarnings("JUnitMalformedDeclaration") static class ReadOnlyFileInDirInReadOnlyDirDoesNotCauseFailureTestCase { @Test @@ -670,7 +680,7 @@ void createReadOnlyFileInReadOnlyDir(@TempDir File tempDir) throws IOException { } // https://github.com/junit-team/junit5/issues/2609 - @SuppressWarnings("ResultOfMethodCallIgnored") + @SuppressWarnings({ "ResultOfMethodCallIgnored", "JUnitMalformedDeclaration" }) static class NonMintPermissionContentInTempDirectoryDoesNotCauseFailureTestCase { @Test @@ -1049,6 +1059,7 @@ void makeTempDirectoryWithNonEmptyFolderContainingNonReadableFileNonExecutable(@ } // https://github.com/junit-team/junit5/issues/2079 + @SuppressWarnings("JUnitMalformedDeclaration") static class TempDirUsageInsideNestedClassesTestCase { @TempDir @@ -1081,6 +1092,7 @@ void deeplyNested() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class StaticTempDirUsageInsideNestedClassTestCase { @TempDir @@ -1107,6 +1119,7 @@ void nested() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("class") static class AllPossibleDeclarationLocationsTestCase { @@ -1228,6 +1241,7 @@ void reportTempDir(TestReporter reporter) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class UndeletableDirectoryTestCase extends UndeletableTestCase { @Test void test() throws Exception { @@ -1235,6 +1249,7 @@ void test() throws Exception { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class UndeletableFileTestCase extends UndeletableTestCase { @Test void test() throws Exception { @@ -1242,6 +1257,7 @@ void test() throws Exception { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryWithTestMethodNameAsPrefixTestCase { @Test @@ -1262,6 +1278,7 @@ public Path createTempDirectory(AnnotatedElementContext elementContext, Extensio } // https://github.com/junit-team/junit5/issues/2088 + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryWithCustomParentDirectoryTestCase { @Test @@ -1287,6 +1304,7 @@ public Path createTempDirectory(AnnotatedElementContext elementContext, Extensio } + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryWithMemoryFileSystemTestCase { @Test @@ -1315,6 +1333,7 @@ public void close() throws IOException { } + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryWithJimfsTestCase { @Test @@ -1343,6 +1362,7 @@ public void close() throws IOException { } + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryWithAnnotatedElementNameAsPrefixTestCase { @TempDir(factory = Factory.class) @@ -1370,6 +1390,7 @@ private static String getName(AnnotatedElement element) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryWithCustomMetaAnnotationTestCase { @TempDirForField @@ -1416,6 +1437,7 @@ public Path createTempDirectory(AnnotatedElementContext elementContext, Extensio } + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryNotReturningDirectoryTestCase { @Test @@ -1433,6 +1455,7 @@ public Path createTempDirectory(AnnotatedElementContext elementContext, Extensio } + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryReturningNonDefaultFileSystemPathForFileAnnotatedElementTestCase { @Test @@ -1458,6 +1481,7 @@ public void close() throws IOException { } + @SuppressWarnings("JUnitMalformedDeclaration") static class StandardDefaultFactoryTestCase { @Test @@ -1469,6 +1493,7 @@ void test(@TempDir Path tempDir1, @TempDir Path tempDir2) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class CustomDefaultFactoryTestCase { @Test @@ -1480,6 +1505,7 @@ void test(@TempDir Path tempDir1, @TempDir Path tempDir2) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class CustomDefaultFactoryWithStandardDeclarationTestCase { @Test @@ -1491,6 +1517,7 @@ void test(@TempDir Path tempDir1, @TempDir(factory = Standard.class) Path tempDi } + @SuppressWarnings("JUnitMalformedDeclaration") static class CustomDefaultFactoryNotReturningDirectoryTestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPreconditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPreconditionTests.java index 659dfca5771a..ebfa6cd8a054 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPreconditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPreconditionTests.java @@ -87,6 +87,7 @@ void finalInstanceFieldIsNotSupported() { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class ParameterTypeTestCase { @Test @@ -98,6 +99,7 @@ void invalidTempDirType(@TempDir String text) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class FinalStaticFieldTestCase { static final @TempDir Path path = Paths.get("."); @@ -107,6 +109,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class FinalInstanceFieldTestCase { final @TempDir Path path = Paths.get("."); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestExecutionExceptionHandlerTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestExecutionExceptionHandlerTests.java index 71a5b9e65934..86a07926465b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestExecutionExceptionHandlerTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestExecutionExceptionHandlerTests.java @@ -133,6 +133,7 @@ void severalHandlersAreCalledInOrder() { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class ATestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java index 48d4218faccd..8ed6da8c23d8 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java @@ -431,6 +431,7 @@ void instanceFactoryWithLegacyContext() { // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooInstanceFactory.class, BarInstanceFactory.class }) static class MultipleFactoriesRegisteredOnSingleTestCase { @@ -440,6 +441,7 @@ void testShouldNotBeCalled() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(NullTestInstanceFactory.class) static class NullTestInstanceFactoryTestCase { @@ -453,6 +455,7 @@ void testShouldNotBeCalled() { static class PerClassLifecycleNullTestInstanceFactoryTestCase extends NullTestInstanceFactoryTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(BogusTestInstanceFactory.class) static class BogusTestInstanceFactoryTestCase { @@ -466,6 +469,7 @@ void testShouldNotBeCalled() { static class PerClassLifecycleBogusTestInstanceFactoryTestCase extends BogusTestInstanceFactoryTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExplosiveTestInstanceFactory.class) static class ExplosiveTestInstanceFactoryTestCase { @@ -488,6 +492,7 @@ public Object createTestInstance(TestInstanceFactoryContext factoryContext, Exte } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(MultipleConstructorsTestInstanceFactory.class) static class MultipleConstructorsTestCase { @@ -507,6 +512,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooInstanceFactory.class) static class ParentTestCase { @@ -516,6 +522,7 @@ void parentTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class InheritedFactoryTestCase extends ParentTestCase { @Test @@ -524,6 +531,7 @@ void childTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(BarInstanceFactory.class) static class MultipleFactoriesRegisteredWithinClassHierarchyTestCase extends ParentTestCase { @@ -533,6 +541,7 @@ void childTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooInstanceFactory.class) static class OuterTestCase { @@ -560,6 +569,7 @@ void innerTest2() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooInstanceFactory.class) static class MultipleFactoriesRegisteredWithinNestedClassStructureTestCase { @@ -581,6 +591,7 @@ void innerTest() { interface TestInterface { } + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryFromInterfaceTestCase implements TestInterface { @Test @@ -589,6 +600,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class LambdaFactoryTestCase { private final String text; @@ -611,6 +623,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooInstanceFactory.class) @TestInstance(PER_CLASS) static class PerClassLifecycleTestCase { @@ -647,6 +660,7 @@ void afterAll() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(LegacyInstanceFactory.class) static class LegacyContextTestCase { @@ -670,6 +684,7 @@ void innerTest2() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ProxyTestInstanceFactory.class) @TestInstance(PER_CLASS) static class ProxiedTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorAndPreDestroyCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorAndPreDestroyCallbackTests.java index fec5ad33bb04..bcd968a5f466 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorAndPreDestroyCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorAndPreDestroyCallbackTests.java @@ -120,6 +120,7 @@ private void assertPostProcessorAndPreDestroyCallbacks(Class testClass, int t // ------------------------------------------------------------------------- // Must NOT be private; otherwise, the @Test method gets discovered but never executed. + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooTestInstanceCallbacks.class, BarTestInstanceCallbacks.class }) static class TopLevelTestCase { @@ -130,6 +131,7 @@ void test() { } // Must NOT be private; otherwise, the @Test method gets discovered but never executed. + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(BazTestInstanceCallbacks.class) static class SecondLevelTestCase extends TopLevelTestCase { @@ -140,6 +142,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(QuuxTestInstanceCallbacks.class) static class ThirdLevelTestCase extends SecondLevelTestCase { @@ -150,6 +153,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExceptionThrowingTestInstancePreDestroyCallback.class) static class ExceptionInTestInstancePreDestroyCallbackTestCase { @@ -159,6 +163,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExceptionThrowingTestInstancePostProcessor.class) static class ExceptionInTestInstancePostProcessorTestCase { @@ -168,6 +173,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooTestInstanceCallbacks.class) static class ExceptionInTestClassConstructorTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java index 416e90e8e532..b6c1a3aaf976 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java @@ -96,6 +96,7 @@ void testSpecificTestInstancePostProcessorIsCalled() { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooInstancePostProcessor.class) @ExtendWith(LegacyInstancePostProcessor.class) static class OuterTestCase implements Named { @@ -149,6 +150,7 @@ void testInner() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithTestSpecificTestInstancePostProcessor implements Named { private final Map names = new HashMap<>(); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java index 4da0833bd0d7..b3536eeae8d7 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java @@ -246,6 +246,7 @@ protected static void record(String event) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(InstancePreConstructCallbackRecordingFoo.class) static class InstancePreConstructTestCase extends CallSequenceRecordingTestCase { @@ -284,6 +285,7 @@ static void afterAll() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(InstancePreConstructCallbackRecordingFoo.class) static class FactoryPreConstructTestCase extends CallSequenceRecordingTestCase { @@ -328,6 +330,7 @@ static void afterAll() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(InstancePreConstructCallbackRecordingFoo.class) static class PreConstructInNestedTestCase extends CallSequenceRecordingTestCase { @@ -405,6 +408,7 @@ void afterEachInner() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class PreConstructOnMethod extends CallSequenceRecordingTestCase { PreConstructOnMethod() { record("constructor"); @@ -432,6 +436,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestInstance(TestInstance.Lifecycle.PER_CLASS) @ExtendWith(InstancePreConstructCallbackRecordingFoo.class) @ExtendWith(InstancePreConstructCallbackRecordingBar.class) @@ -456,6 +461,7 @@ void test2() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(InstancePreConstructCallbackRecordingFoo.class) @ExtendWith(InstancePreConstructCallbackRecordingLegacy.class) static class LegacyPreConstructTestCase extends CallSequenceRecordingTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreDestroyCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreDestroyCallbackTests.java index a417a00e8db7..3ae4d8997537 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreDestroyCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreDestroyCallbackTests.java @@ -104,6 +104,7 @@ void setDestroyed() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooInstancePreDestroyCallback.class) static class OuterTestCase extends Destroyable { @@ -136,6 +137,7 @@ void testInner() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithTestSpecificTestInstancePreDestroyCallback extends Destroyable { @BeforeEach @@ -151,6 +153,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestInstance(PER_CLASS) @ExtendWith(FooInstancePreDestroyCallback.class) @ExtendWith(BarInstancePreDestroyCallback.class) diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestWatcherTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestWatcherTests.java index a8400aa63ba3..fdbde376dfe9 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestWatcherTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestWatcherTests.java @@ -355,6 +355,7 @@ static class TestInstancePerMethodInstanceLevelTestWatcherTestCase extends Abstr TestWatcher watcher = new TrackingTestWatcher(); } + @SuppressWarnings("JUnitMalformedDeclaration") static class MethodLevelTestWatcherTestCase extends AbstractDisabledMethodsTestCase { @Override @@ -456,6 +457,7 @@ private static Store getStore(ExtensionContext context) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(DataRetrievingTestWatcher.class) static class DataRetrievingTestWatcherTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutExtensionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutExtensionTests.java index 7a317a6f946f..85b00639a6bd 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutExtensionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutExtensionTests.java @@ -503,6 +503,7 @@ void nonTimeoutExceededInSeparateThreadOnClassLevel() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TimeoutAnnotatedTestMethodTestCase { @Test @Timeout(value = 10, unit = MILLISECONDS) @@ -524,6 +525,7 @@ Stream testFactoryMethod() throws Exception { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TimeoutAnnotatedBeforeAllMethodTestCase { @BeforeAll @Timeout(value = 10, unit = MILLISECONDS) @@ -537,6 +539,7 @@ void testMethod() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TimeoutAnnotatedBeforeEachMethodTestCase { @BeforeEach @Timeout(value = 10, unit = MILLISECONDS) @@ -550,6 +553,7 @@ void testMethod() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TimeoutAnnotatedAfterEachMethodTestCase { @Test void testMethod() { @@ -563,6 +567,7 @@ void tearDown() throws Exception { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TimeoutAnnotatedAfterAllMethodTestCase { @Test void testMethod() { @@ -601,6 +606,7 @@ Stream testFactoryMethod() throws Exception { static class InheritedTimeoutAnnotatedClassTestCase extends TimeoutAnnotatedClassTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") static class MethodWithoutInterruptedExceptionTestCase { @Test @Timeout(value = 1, unit = MILLISECONDS) @@ -609,6 +615,7 @@ void methodThatDoesNotThrowInterruptedException() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class PlainTestCase { public static String slowMethod; @@ -656,6 +663,7 @@ private static void waitForInterrupt(String methodName) throws InterruptedExcept } } + @SuppressWarnings("JUnitMalformedDeclaration") static class UnrecoverableExceptionTestCase { @Test @Timeout(value = 1, unit = NANOSECONDS) @@ -665,6 +673,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @Timeout(10) static class NonTimeoutExceedingTestCase { @Test @@ -705,6 +714,7 @@ void testMethod() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class IllegalTimeoutDurationTestCase { @Test @@ -714,6 +724,7 @@ void testMethod() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class TimeoutExceedingWithInferredThreadModeTestCase { @Test @Timeout(value = 10, unit = MILLISECONDS) @@ -722,6 +733,7 @@ void testMethod() throws InterruptedException { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TimeoutExceedingSeparateThreadTestCase { @Test @Timeout(value = 100, unit = MILLISECONDS, threadMode = SEPARATE_THREAD) @@ -730,6 +742,7 @@ void testMethod() throws InterruptedException { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class NonTimeoutExceedingSeparateThreadTestCase { @Test @Timeout(value = 100, unit = MILLISECONDS, threadMode = SEPARATE_THREAD) @@ -737,6 +750,7 @@ void testMethod() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class UnrecoverableExceptionInSeparateThreadTestCase { @Test @Timeout(value = 100, unit = SECONDS, threadMode = SEPARATE_THREAD) @@ -745,6 +759,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class ExceptionInSeparateThreadTestCase { @Test @Timeout(value = 5, unit = SECONDS, threadMode = SEPARATE_THREAD) @@ -753,6 +768,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class FailedAssertionInSeparateThreadTestCase { @Test @Timeout(value = 5, unit = SECONDS, threadMode = SEPARATE_THREAD) @@ -767,6 +783,7 @@ void testJavaLangAssertion() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @Timeout(value = 100, unit = MILLISECONDS, threadMode = SEPARATE_THREAD) static class TimeoutExceededOnClassLevelTestCase { @Test @@ -775,6 +792,7 @@ void exceptionThrown() throws InterruptedException { } } + @SuppressWarnings("JUnitMalformedDeclaration") @Timeout(value = 100, unit = MILLISECONDS, threadMode = SEPARATE_THREAD) static class NonTimeoutExceededOnClassLevelTestCase { @Test @@ -782,6 +800,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(OrderAnnotation.class) static class OneTestStuckForeverAndTheOthersNotTestCase { @@ -805,6 +824,7 @@ void testOne() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class MixedSameThreadAndSeparateThreadTestCase { @Test @Timeout(value = 10, unit = MILLISECONDS, threadMode = SEPARATE_THREAD) @@ -825,6 +845,7 @@ void testTwo() throws InterruptedException { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(OrderAnnotation.class) static class OneTestStuckForeverAndTheOthersInSameThreadNotTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/conditions/IgnoreConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/conditions/IgnoreConditionTests.java index f427d7d6769d..b50fe4528742 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/conditions/IgnoreConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/conditions/IgnoreConditionTests.java @@ -106,6 +106,7 @@ private EngineExecutionResults executeTestsForClass(Class testClass) { // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(IgnoreCondition.class) @Ignore static class IgnoredClassWithDefaultMessageTestCase { @@ -116,6 +117,7 @@ void ignoredBecauseClassIsIgnored() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(IgnoreCondition.class) @Ignore("Ignored Class") static class IgnoredClassWithCustomMessageTestCase { @@ -126,6 +128,7 @@ void ignoredBecauseClassIsIgnored() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(IgnoreCondition.class) static class IgnoredMethodsTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExpectedExceptionSupportTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExpectedExceptionSupportTests.java index be8df6202fd0..cf54fc79e067 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExpectedExceptionSupportTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExpectedExceptionSupportTests.java @@ -76,6 +76,7 @@ private Events executeTestsForClass(Class testClass) { return EngineTestKit.execute("junit-jupiter", request().selectors(selectClass(testClass)).build()).testEvents(); } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExpectedExceptionSupport.class) static class ExpectedExceptionTestCase { @@ -107,6 +108,7 @@ void correctExceptionExpectedThrown() { } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExpectedExceptionSupport.class) static class ExpectedExceptionSupportWithoutExpectedExceptionRuleTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMixedMethodAndFieldRulesTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMixedMethodAndFieldRulesTests.java index e02d4d774ccc..18567a385668 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMixedMethodAndFieldRulesTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMixedMethodAndFieldRulesTests.java @@ -45,11 +45,13 @@ static void clear() { @Rule public ExternalResource fieldRule2 = new MyExternalResource("fieldRule2"); + @SuppressWarnings("JUnitMalformedDeclaration") @Rule ExternalResource methodRule1() { return new MyExternalResource("methodRule1"); } + @SuppressWarnings("JUnitMalformedDeclaration") @Rule ExternalResource methodRule2() { return new MyExternalResource("methodRule2"); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/LauncherBasedEnableRuleMigrationSupportTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/LauncherBasedEnableRuleMigrationSupportTests.java index 558a9c490336..13194fa224d5 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/LauncherBasedEnableRuleMigrationSupportTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/LauncherBasedEnableRuleMigrationSupportTests.java @@ -52,6 +52,7 @@ private Events executeTestsForClass(Class testClass) { return EngineTestKit.execute("junit-jupiter", request().selectors(selectClass(testClass)).build()).testEvents(); } + @SuppressWarnings("JUnitMalformedDeclaration") @EnableRuleMigrationSupport static class EnableRuleMigrationSupportWithBothRuleTypesTestCase { @@ -93,6 +94,7 @@ void beforeMethodOfBothRule2WasExecuted() { } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(VerifierSupport.class) static class VerifierSupportForErrorCollectorTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java index 3172140691ae..01dbe93e407c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java @@ -304,6 +304,7 @@ void method() { static class TestCaseWithAnnotatedMethod { + @SuppressWarnings("JUnitMalformedDeclaration") @ParameterizedTest void method() { } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java index 56418a7a84f9..9e5c5a8e6910 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java @@ -2149,6 +2149,7 @@ void testWithRepeatableMethodSource(String argument) { @interface TwoMethodSources { } + @SuppressWarnings("JUnitMalformedDeclaration") @ParameterizedTest @TwoMethodSources void testWithRepeatableMethodSourceAsMetaAnnotation(String argument) { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/AggregatorIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/AggregatorIntegrationTests.java index a6601c9ec05e..96a4890088b1 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/AggregatorIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/AggregatorIntegrationTests.java @@ -410,6 +410,7 @@ static class CountingTestCase { static final List output = new ArrayList<>(); + @SuppressWarnings("JUnitMalformedDeclaration") @ParameterizedTest @ValueSource(ints = { 1, 2, 3 }) void testWithCountingConverterAggregator(@ConvertWith(InstanceCountingConverter.class) int i, diff --git a/platform-tests/src/test/java/org/junit/platform/StackTracePruningTests.java b/platform-tests/src/test/java/org/junit/platform/StackTracePruningTests.java index 1babd73c2766..14efaa029759 100644 --- a/platform-tests/src/test/java/org/junit/platform/StackTracePruningTests.java +++ b/platform-tests/src/test/java/org/junit/platform/StackTracePruningTests.java @@ -195,6 +195,7 @@ private static void assertStackTraceDoesNotContain(List stack // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class FailingTestTestCase { @Test @@ -216,6 +217,7 @@ void failingAssumption() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class FailingBeforeEachTestCase { @BeforeEach diff --git a/platform-tests/src/test/java/org/junit/platform/commons/support/ModifierSupportTests.java b/platform-tests/src/test/java/org/junit/platform/commons/support/ModifierSupportTests.java index 81fc84a10325..00ed5422a5b8 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/support/ModifierSupportTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/support/ModifierSupportTests.java @@ -45,6 +45,7 @@ void isPublicDelegates(Class clazz) { assertEquals(ReflectionUtils.isPublic(clazz), ModifierSupport.isPublic(clazz)); } + @SuppressWarnings("JUnitMalformedDeclaration") @Methods void isPublicDelegates(Method method) { assertEquals(ReflectionUtils.isPublic(method), ModifierSupport.isPublic(method)); @@ -61,6 +62,7 @@ void isPrivateDelegates(Class clazz) { assertEquals(ReflectionUtils.isPrivate(clazz), ModifierSupport.isPrivate(clazz)); } + @SuppressWarnings("JUnitMalformedDeclaration") @Methods void isPrivateDelegates(Method method) { assertEquals(ReflectionUtils.isPrivate(method), ModifierSupport.isPrivate(method)); @@ -77,6 +79,7 @@ void isNotPrivateDelegates(Class clazz) { assertEquals(ReflectionUtils.isNotPrivate(clazz), ModifierSupport.isNotPrivate(clazz)); } + @SuppressWarnings("JUnitMalformedDeclaration") @Methods void isNotPrivateDelegates(Method method) { assertEquals(ReflectionUtils.isNotPrivate(method), ModifierSupport.isNotPrivate(method)); @@ -93,6 +96,7 @@ void isAbstractDelegates(Class clazz) { assertEquals(ReflectionUtils.isAbstract(clazz), ModifierSupport.isAbstract(clazz)); } + @SuppressWarnings("JUnitMalformedDeclaration") @Methods void isAbstractDelegates(Method method) { assertEquals(ReflectionUtils.isAbstract(method), ModifierSupport.isAbstract(method)); @@ -109,6 +113,7 @@ void isStaticDelegates(Class clazz) { assertEquals(ReflectionUtils.isStatic(clazz), ModifierSupport.isStatic(clazz)); } + @SuppressWarnings("JUnitMalformedDeclaration") @Methods void isStaticDelegates(Method method) { assertEquals(ReflectionUtils.isStatic(method), ModifierSupport.isStatic(method)); @@ -125,6 +130,7 @@ void isNotStaticDelegates(Class clazz) { assertEquals(ReflectionUtils.isNotStatic(clazz), ModifierSupport.isNotStatic(clazz)); } + @SuppressWarnings("JUnitMalformedDeclaration") @Methods void isNotStaticDelegates(Method method) { assertEquals(ReflectionUtils.isNotStatic(method), ModifierSupport.isNotStatic(method)); @@ -141,6 +147,7 @@ void isFinalDelegates(Class clazz) { assertEquals(ReflectionUtils.isFinal(clazz), ModifierSupport.isFinal(clazz)); } + @SuppressWarnings("JUnitMalformedDeclaration") @Methods void isFinalDelegates(Method method) { assertEquals(ReflectionUtils.isFinal(method), ModifierSupport.isFinal(method)); @@ -157,6 +164,7 @@ void isNotFinalDelegates(Class clazz) { assertEquals(ReflectionUtils.isNotFinal(clazz), ModifierSupport.isNotFinal(clazz)); } + @SuppressWarnings("JUnitMalformedDeclaration") @Methods void isNotFinalDelegates(Method method) { assertEquals(ReflectionUtils.isNotFinal(method), ModifierSupport.isNotFinal(method)); diff --git a/platform-tests/src/test/java/org/junit/platform/console/ConsoleDetailsTests.java b/platform-tests/src/test/java/org/junit/platform/console/ConsoleDetailsTests.java index 2a3c4571f5ee..f4d7d80e4609 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/ConsoleDetailsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/ConsoleDetailsTests.java @@ -109,6 +109,7 @@ private List scanContainerClassAndCreateDynamicTests(Class conta return nodes; } + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("Basic") static class BasicTestCase { @@ -123,6 +124,7 @@ void changeDisplayName() { } + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("Skip") static class SkipTestCase { @@ -138,6 +140,7 @@ void skipWithMultiLineMessage() { } + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("Fail") static class FailTestCase { @@ -153,6 +156,7 @@ void failWithMultiLineMessage() { } + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("Report") static class ReportTestCase { diff --git a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTest.java b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTest.java index ecbe48c2e587..be1624fa7d87 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTest.java +++ b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTest.java @@ -18,6 +18,7 @@ // problem since the test method here can never fail. class ContainerForStaticNestedTest { + @SuppressWarnings("JUnitMalformedDeclaration") static class NestedTest { @Test diff --git a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTests.java b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTests.java index 9f51d250dee0..bf95368df12a 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTests.java @@ -18,6 +18,7 @@ // problem since the test method here can never fail. class ContainerForStaticNestedTests { + @SuppressWarnings("JUnitMalformedDeclaration") static class NestedTests { @Test diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java index 414e31c96993..e5f3d65fb099 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java @@ -214,6 +214,7 @@ private Set getNestedClassResources(Class testClass, Class // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class NoSharedResourcesTestCase { @Test @@ -225,6 +226,7 @@ class NestedClass { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock("a1") @ResourceLock(value = "a2", mode = ResourceAccessMode.READ_WRITE) static class SharedResourcesViaAnnotationValueTestCase { @@ -242,6 +244,7 @@ class NestedClass { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock(providers = { // SharedResourcesViaAnnotationProvidersTestCase.FirstClassLevelProvider.class, // SharedResourcesViaAnnotationProvidersTestCase.SecondClassLevelProvider.class // @@ -296,6 +299,7 @@ public Set provideForNestedClass(Class testClass) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock( // value = "a1", // mode = ResourceAccessMode.READ_WRITE, // @@ -341,6 +345,7 @@ public Set provideForNestedClass(Class testClass) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock static class EmptyAnnotationTestCase { @@ -357,6 +362,7 @@ class NestedClass { static class NestedNestedTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @Nested @ResourceLock(providers = NestedNestedTestCase.Provider.class) static class NestedClass { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalkerIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalkerIntegrationTests.java index afb9addda85f..6e0a7f4c78c9 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalkerIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalkerIntegrationTests.java @@ -192,6 +192,7 @@ private TestDescriptor discover(Class testClass) { return new JupiterTestEngine().discover(discoveryRequest, UniqueId.forEngine("junit-jupiter")); } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock("a") static class TestCaseWithResourceLock { @Test @@ -200,6 +201,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithoutResourceLock { @Test @ResourceLock("a") @@ -227,6 +229,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock("a") static class TestCaseWithResourceWriteLockOnClass { @Test @@ -234,6 +237,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock(value = "a", mode = ResourceAccessMode.READ) static class TestCaseWithResourceReadLockOnClass { @Test @@ -241,6 +245,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock(value = "a", mode = ResourceAccessMode.READ) static class TestCaseWithResourceReadLockOnClassAndWriteClockOnTestCase { @Test @@ -249,6 +254,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock(value = "a", mode = ResourceAccessMode.READ) static class TestCaseWithResourceReadLockOnClassAndReadClockOnTestCase { @Test diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SameThreadExecutionIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SameThreadExecutionIntegrationTests.java index 64b1939cfe5e..ab06a7ed6982 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SameThreadExecutionIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SameThreadExecutionIntegrationTests.java @@ -53,6 +53,7 @@ private LogRecord firstDebugLogRecord(LogRecordListener listener) throws Asserti // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(MethodName.class) static class InterruptedThreadTestCase { diff --git a/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java index c209c692907b..7d3fe88736a4 100644 --- a/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java @@ -65,6 +65,7 @@ void reportsEvents() { .with("reason", "for demonstration purposes")); } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase { @Test void test(TestReporter reporter) { diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/TagIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/TagIntegrationTests.java index 745550c514f6..027a2228b1a8 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/TagIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/TagIntegrationTests.java @@ -85,6 +85,7 @@ private void executeTaggedTestCase(PostDiscoveryFilter filter) { .execute(); } + @SuppressWarnings("JUnitMalformedDeclaration") static class TaggedTestCase { static boolean tag1WasExecuted = false; diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherConfigurationParametersTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherConfigurationParametersTests.java index 3ef5cb275ee4..ccac05dcc9f7 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherConfigurationParametersTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherConfigurationParametersTests.java @@ -266,6 +266,7 @@ public void postProcessTestInstance(Object testInstance, ExtensionContext contex } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(Mutator.class) static class Something { diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java index 7bd1fc8f5d31..fcd7345b227f 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java @@ -397,6 +397,7 @@ void createsCompositeForMultipleListeners() { } + @SuppressWarnings("JUnitMalformedDeclaration") private static class SampleTestClass { @Test diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java index e3831ab4e81e..ed5b7d755c68 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java @@ -360,7 +360,7 @@ private LauncherDiscoveryRequest createLauncherDiscoveryRequestForBothStandardEn // @formatter:on } - @SuppressWarnings("NewClassNamingConvention") + @SuppressWarnings({ "NewClassNamingConvention", "JUnitMalformedDeclaration" }) public static class JUnit4Example { @org.junit.Test @@ -369,7 +369,7 @@ public void testJ4() { } - @SuppressWarnings("NewClassNamingConvention") + @SuppressWarnings({ "NewClassNamingConvention", "JUnitMalformedDeclaration" }) static class JUnit5Example { @Tag("test-post-discovery") diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListenerIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListenerIntegrationTests.java index 9d56bddc5761..ada4c823a6ad 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListenerIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListenerIntegrationTests.java @@ -294,6 +294,7 @@ private Stream readAllFiles(String outputDir, String prefix) throws IOEx // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase1 { @Test @@ -321,6 +322,7 @@ Stream dynamicTests() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase2 { @Test @@ -332,6 +334,7 @@ void testB() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase3 { @Test @@ -343,6 +346,7 @@ void testD() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase4 { @Test diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/StatefulTestCase.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/StatefulTestCase.java index 3a2a32230c27..b480a7349aa7 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/StatefulTestCase.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/StatefulTestCase.java @@ -24,6 +24,7 @@ public class StatefulTestCase { public static List callSequence = new ArrayList<>(); + @SuppressWarnings("JUnitMalformedDeclaration") public static class Test1 { @Test @@ -33,6 +34,7 @@ void statefulTest() { } + @SuppressWarnings("JUnitMalformedDeclaration") public static class Test2 { @Test diff --git a/platform-tests/src/test/java/org/junit/platform/testkit/engine/EngineTestKitTests.java b/platform-tests/src/test/java/org/junit/platform/testkit/engine/EngineTestKitTests.java index 20d71f0c3def..6e852b821fb7 100644 --- a/platform-tests/src/test/java/org/junit/platform/testkit/engine/EngineTestKitTests.java +++ b/platform-tests/src/test/java/org/junit/platform/testkit/engine/EngineTestKitTests.java @@ -67,6 +67,7 @@ private Optional executeExampleTestCaseAndCollectValue(UnaryOperator stats.skipped(1).started(3).succeeded(1).aborted(1).failed(1)); } + @SuppressWarnings("JUnitMalformedDeclaration") static class ExampleTestCase { @Test diff --git a/platform-tests/src/test/java/org/junit/platform/testkit/engine/NestedContainerEventConditionTests.java b/platform-tests/src/test/java/org/junit/platform/testkit/engine/NestedContainerEventConditionTests.java index e7faa286c983..d328eb1065d5 100644 --- a/platform-tests/src/test/java/org/junit/platform/testkit/engine/NestedContainerEventConditionTests.java +++ b/platform-tests/src/test/java/org/junit/platform/testkit/engine/NestedContainerEventConditionTests.java @@ -123,6 +123,7 @@ void eventConditionsForMultipleLevelsOfNestedClasses() { // @formatter:on } + @SuppressWarnings("JUnitMalformedDeclaration") static class ATestCase { @Test