diff --git a/spring-test/src/main/java/org/springframework/test/context/aot/DisabledInAotMode.java b/spring-test/src/main/java/org/springframework/test/context/aot/DisabledInAotMode.java index c23454bc81..ad6f16969c 100644 --- a/spring-test/src/main/java/org/springframework/test/context/aot/DisabledInAotMode.java +++ b/spring-test/src/main/java/org/springframework/test/context/aot/DisabledInAotMode.java @@ -59,4 +59,19 @@ import org.junit.jupiter.api.extension.ExtendWith; @Documented @ExtendWith(DisabledInAotModeCondition.class) public @interface DisabledInAotMode { + + /** + * Custom reason to document why the test class or test method is disabled in + * AOT mode. + *
If a custom reason is not supplied, the default reason will be used: + * {@code "Disabled in Spring AOT mode"}. + *
If a custom reason is supplied, it will be combined with the default + * reason. For example, + * {@code @DisabledInAotMode("@ContextHierarchy is not supported")} will result + * in a combined reason like the following: + * {@code "Disabled in Spring AOT mode ==> @ContextHierarchy is not supported"}. + * @since 6.2 + */ + String value() default ""; + } diff --git a/spring-test/src/main/java/org/springframework/test/context/aot/DisabledInAotModeCondition.java b/spring-test/src/main/java/org/springframework/test/context/aot/DisabledInAotModeCondition.java index e1e2d0d48d..d0586931e3 100644 --- a/spring-test/src/main/java/org/springframework/test/context/aot/DisabledInAotModeCondition.java +++ b/spring-test/src/main/java/org/springframework/test/context/aot/DisabledInAotModeCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,16 +16,22 @@ package org.springframework.test.context.aot; +import java.lang.annotation.Annotation; +import java.lang.reflect.AnnotatedElement; +import java.util.Optional; + import org.junit.jupiter.api.extension.ConditionEvaluationResult; import org.junit.jupiter.api.extension.ExecutionCondition; import org.junit.jupiter.api.extension.ExtensionContext; import org.springframework.aot.AotDetector; +import org.springframework.core.annotation.AnnotatedElementUtils; /** - * {@link ExecutionCondition} implementation for {@link DisabledInAotMode}. + * {@link ExecutionCondition} implementation for {@link DisabledInAotMode @DisabledInAotMode}. * * @author Stephane Nicoll + * @author Sam Brannen * @since 6.1.2 */ class DisabledInAotModeCondition implements ExecutionCondition { @@ -34,9 +40,18 @@ class DisabledInAotModeCondition implements ExecutionCondition { public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) { boolean aotEnabled = AotDetector.useGeneratedArtifacts(); if (aotEnabled) { - return ConditionEvaluationResult.disabled("Disabled in Spring AOT mode"); + AnnotatedElement element = context.getElement().orElseThrow(() -> new IllegalStateException("No AnnotatedElement")); + String customReason = findMergedAnnotation(element, DisabledInAotMode.class) + .map(DisabledInAotMode::value).orElse(null); + return ConditionEvaluationResult.disabled("Disabled in Spring AOT mode", customReason); } - return ConditionEvaluationResult.enabled("Spring AOT mode disabled"); + return ConditionEvaluationResult.enabled("Spring AOT mode is not enabled"); + } + + private static Optional findMergedAnnotation( + AnnotatedElement element, Class annotationType) { + + return Optional.ofNullable(AnnotatedElementUtils.findMergedAnnotation(element, annotationType)); } } diff --git a/spring-test/src/test/java/org/springframework/test/context/aot/DisabledInAotModeTests.java b/spring-test/src/test/java/org/springframework/test/context/aot/DisabledInAotModeTests.java new file mode 100644 index 0000000000..326b53d5ee --- /dev/null +++ b/spring-test/src/test/java/org/springframework/test/context/aot/DisabledInAotModeTests.java @@ -0,0 +1,81 @@ +/* + * Copyright 2002-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.test.context.aot; + +import org.junit.jupiter.api.Test; +import org.junit.platform.testkit.engine.EngineTestKit; + +import org.springframework.aot.AotDetector; + +import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; +import static org.junit.platform.testkit.engine.EventConditions.container; +import static org.junit.platform.testkit.engine.EventConditions.event; +import static org.junit.platform.testkit.engine.EventConditions.skippedWithReason; + +/** + * Tests for {@link DisabledInAotMode @DisabledInAotMode}. + * + * @author Sam Brannen + * @since 6.2 + */ +class DisabledInAotModeTests { + + @Test + void defaultDisabledReason() { + runTestsInAotMode(DefaultReasonTestCase.class, "Disabled in Spring AOT mode"); + } + + @Test + void customDisabledReason() { + runTestsInAotMode(CustomReasonTestCase.class, "Disabled in Spring AOT mode ==> @ContextHierarchy is not supported in AOT"); + } + + + private static void runTestsInAotMode(Class> testClass, String expectedReason) { + try { + System.setProperty(AotDetector.AOT_ENABLED, "true"); + + EngineTestKit.engine("junit-jupiter") + .selectors(selectClass(testClass)) + .execute() + .allEvents() + .assertThatEvents().haveExactly(1, + event(container(testClass.getSimpleName()), skippedWithReason(expectedReason))); + } + finally { + System.clearProperty(AotDetector.AOT_ENABLED); + } + } + + + @DisabledInAotMode + static class DefaultReasonTestCase { + + @Test + void test() { + } + } + + @DisabledInAotMode("@ContextHierarchy is not supported in AOT") + static class CustomReasonTestCase { + + @Test + void test() { + } + } + +} diff --git a/spring-test/src/test/java/org/springframework/test/context/bean/override/mockito/integration/MockitoSpyBeanAndCircularDependenciesWithAutowiredSettersIntegrationTests.java b/spring-test/src/test/java/org/springframework/test/context/bean/override/mockito/integration/MockitoSpyBeanAndCircularDependenciesWithAutowiredSettersIntegrationTests.java index ce67145b85..b469f9aa74 100644 --- a/spring-test/src/test/java/org/springframework/test/context/bean/override/mockito/integration/MockitoSpyBeanAndCircularDependenciesWithAutowiredSettersIntegrationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/bean/override/mockito/integration/MockitoSpyBeanAndCircularDependenciesWithAutowiredSettersIntegrationTests.java @@ -38,7 +38,7 @@ import static org.mockito.BDDMockito.then; * @see MockitoSpyBeanAndCircularDependenciesWithLazyResolutionProxyIntegrationTests */ @SpringJUnitConfig -@DisabledInAotMode // Circular dependencies cannot be resolved in AOT mode unless a @Lazy resolution proxy is used. +@DisabledInAotMode("Circular dependencies cannot be resolved in AOT mode unless a @Lazy resolution proxy is used") class MockitoSpyBeanAndCircularDependenciesWithAutowiredSettersIntegrationTests { @MockitoSpyBean diff --git a/spring-test/src/test/java/org/springframework/test/context/bean/override/mockito/integration/MockitoSpyBeanAndContextHierarchyChildIntegrationTests.java b/spring-test/src/test/java/org/springframework/test/context/bean/override/mockito/integration/MockitoSpyBeanAndContextHierarchyChildIntegrationTests.java index 08783244f3..b5f02fa893 100644 --- a/spring-test/src/test/java/org/springframework/test/context/bean/override/mockito/integration/MockitoSpyBeanAndContextHierarchyChildIntegrationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/bean/override/mockito/integration/MockitoSpyBeanAndContextHierarchyChildIntegrationTests.java @@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @see MockitoBeanAndContextHierarchyParentIntegrationTests */ @ContextHierarchy(@ContextConfiguration) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") public class MockitoSpyBeanAndContextHierarchyChildIntegrationTests extends MockitoBeanAndContextHierarchyParentIntegrationTests { diff --git a/spring-test/src/test/java/org/springframework/test/context/configuration/interfaces/ContextHierarchyInterfaceTests.java b/spring-test/src/test/java/org/springframework/test/context/configuration/interfaces/ContextHierarchyInterfaceTests.java index 3f9122a2a3..6c23cdb3ab 100644 --- a/spring-test/src/test/java/org/springframework/test/context/configuration/interfaces/ContextHierarchyInterfaceTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/configuration/interfaces/ContextHierarchyInterfaceTests.java @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @since 4.3 */ @ExtendWith(SpringExtension.class) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class ContextHierarchyInterfaceTests implements ContextHierarchyTestInterface { @Autowired diff --git a/spring-test/src/test/java/org/springframework/test/context/env/ExplicitPropertiesFileInClasspathTestPropertySourceTests.java b/spring-test/src/test/java/org/springframework/test/context/env/ExplicitPropertiesFileInClasspathTestPropertySourceTests.java index d278c2a188..4b7d74ea47 100644 --- a/spring-test/src/test/java/org/springframework/test/context/env/ExplicitPropertiesFileInClasspathTestPropertySourceTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/env/ExplicitPropertiesFileInClasspathTestPropertySourceTests.java @@ -27,7 +27,6 @@ import org.springframework.test.context.aot.DisabledInAotMode; * @since 4.1 */ @TestPropertySource("explicit.properties") -// Since ExplicitPropertiesFileTestPropertySourceTests is disabled in AOT mode, this class must be also. -@DisabledInAotMode +@DisabledInAotMode("Because ExplicitPropertiesFileTestPropertySourceTests is disabled in AOT mode") public class ExplicitPropertiesFileInClasspathTestPropertySourceTests extends AbstractExplicitPropertiesFileTests { } diff --git a/spring-test/src/test/java/org/springframework/test/context/env/ExplicitPropertiesFileTestPropertySourceTests.java b/spring-test/src/test/java/org/springframework/test/context/env/ExplicitPropertiesFileTestPropertySourceTests.java index 51fb4cb3c5..ec969da651 100644 --- a/spring-test/src/test/java/org/springframework/test/context/env/ExplicitPropertiesFileTestPropertySourceTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/env/ExplicitPropertiesFileTestPropertySourceTests.java @@ -35,9 +35,7 @@ import org.springframework.util.ClassUtils; * @since 5.2 */ @DisplayName("Explicit properties file in @TestPropertySource") -// Since Spring test's AOT processing support does not invoke test lifecycle methods such -// as @BeforeAll/@AfterAll, this test class simply is not supported for AOT processing. -@DisabledInAotMode +@DisabledInAotMode("Spring test's AOT processing support does not invoke lifecycle methods such as @BeforeAll/@AfterAll") class ExplicitPropertiesFileTestPropertySourceTests { static final String CURRENT_TEST_PACKAGE = "current.test.package"; diff --git a/spring-test/src/test/java/org/springframework/test/context/env/InheritedRelativePathPropertiesFileTestPropertySourceTests.java b/spring-test/src/test/java/org/springframework/test/context/env/InheritedRelativePathPropertiesFileTestPropertySourceTests.java index 8456f6c373..68e4d6837b 100644 --- a/spring-test/src/test/java/org/springframework/test/context/env/InheritedRelativePathPropertiesFileTestPropertySourceTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/env/InheritedRelativePathPropertiesFileTestPropertySourceTests.java @@ -27,8 +27,7 @@ import org.springframework.test.context.aot.DisabledInAotMode; * @author Sam Brannen * @since 4.1 */ -// Since ExplicitPropertiesFileTestPropertySourceTests is disabled in AOT mode, this class must be also. -@DisabledInAotMode +@DisabledInAotMode("Because ExplicitPropertiesFileTestPropertySourceTests is disabled in AOT mode") class InheritedRelativePathPropertiesFileTestPropertySourceTests extends ExplicitPropertiesFileInClasspathTestPropertySourceTests { diff --git a/spring-test/src/test/java/org/springframework/test/context/env/MergedPropertiesFilesOverriddenByInlinedPropertiesTestPropertySourceTests.java b/spring-test/src/test/java/org/springframework/test/context/env/MergedPropertiesFilesOverriddenByInlinedPropertiesTestPropertySourceTests.java index a9a885c0a0..ea38252019 100644 --- a/spring-test/src/test/java/org/springframework/test/context/env/MergedPropertiesFilesOverriddenByInlinedPropertiesTestPropertySourceTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/env/MergedPropertiesFilesOverriddenByInlinedPropertiesTestPropertySourceTests.java @@ -32,8 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @since 4.1 */ @TestPropertySource(properties = { "explicit = inlined", "extended = inlined1", "extended = inlined2" }) -// Since ExplicitPropertiesFileTestPropertySourceTests is disabled in AOT mode, this class must be also. -@DisabledInAotMode +@DisabledInAotMode("Because ExplicitPropertiesFileTestPropertySourceTests is disabled in AOT mode") class MergedPropertiesFilesOverriddenByInlinedPropertiesTestPropertySourceTests extends MergedPropertiesFilesTestPropertySourceTests { diff --git a/spring-test/src/test/java/org/springframework/test/context/env/MergedPropertiesFilesTestPropertySourceTests.java b/spring-test/src/test/java/org/springframework/test/context/env/MergedPropertiesFilesTestPropertySourceTests.java index be4f2db36a..023aec6037 100644 --- a/spring-test/src/test/java/org/springframework/test/context/env/MergedPropertiesFilesTestPropertySourceTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/env/MergedPropertiesFilesTestPropertySourceTests.java @@ -31,8 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @since 4.1 */ @TestPropertySource("extended.properties") -// Since ExplicitPropertiesFileTestPropertySourceTests is disabled in AOT mode, this class must be also. -@DisabledInAotMode +@DisabledInAotMode("Because ExplicitPropertiesFileTestPropertySourceTests is disabled in AOT mode") class MergedPropertiesFilesTestPropertySourceTests extends ExplicitPropertiesFileInClasspathTestPropertySourceTests { diff --git a/spring-test/src/test/java/org/springframework/test/context/env/subpackage/SubpackageInheritedRelativePathPropertiesFileTestPropertySourceTests.java b/spring-test/src/test/java/org/springframework/test/context/env/subpackage/SubpackageInheritedRelativePathPropertiesFileTestPropertySourceTests.java index 587ab3c7a9..8f2bad7290 100644 --- a/spring-test/src/test/java/org/springframework/test/context/env/subpackage/SubpackageInheritedRelativePathPropertiesFileTestPropertySourceTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/env/subpackage/SubpackageInheritedRelativePathPropertiesFileTestPropertySourceTests.java @@ -28,8 +28,7 @@ import org.springframework.test.context.env.ExplicitPropertiesFileInClasspathTes * @author Sam Brannen * @since 4.1 */ -// Since ExplicitPropertiesFileTestPropertySourceTests is disabled in AOT mode, this class must be also. -@DisabledInAotMode +@DisabledInAotMode("Because ExplicitPropertiesFileTestPropertySourceTests is disabled in AOT mode") class SubpackageInheritedRelativePathPropertiesFileTestPropertySourceTests extends ExplicitPropertiesFileInClasspathTestPropertySourceTests { diff --git a/spring-test/src/test/java/org/springframework/test/context/expression/ExpressionUsageTests.java b/spring-test/src/test/java/org/springframework/test/context/expression/ExpressionUsageTests.java index 6457afdec3..24a937ccdf 100644 --- a/spring-test/src/test/java/org/springframework/test/context/expression/ExpressionUsageTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/expression/ExpressionUsageTests.java @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer */ @SpringJUnitConfig -@DisabledInAotMode // SpEL is not supported in AOT +@DisabledInAotMode("SpEL is not supported in AOT") class ExpressionUsageTests { @Autowired diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/meta/MetaHierarchyLevelOneTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/meta/MetaHierarchyLevelOneTests.java index ef1bdcc228..8fa2a98dc0 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/meta/MetaHierarchyLevelOneTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/meta/MetaHierarchyLevelOneTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @ExtendWith(SpringExtension.class) @MetaMetaContextHierarchyConfig -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class MetaHierarchyLevelOneTests { @Autowired diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/meta/MetaHierarchyLevelTwoTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/meta/MetaHierarchyLevelTwoTests.java index ca17f2cce4..f52b92e26a 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/meta/MetaHierarchyLevelTwoTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/meta/MetaHierarchyLevelTwoTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @ContextConfiguration @ActiveProfiles("prod") -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class MetaHierarchyLevelTwoTests extends MetaHierarchyLevelOneTests { @Configuration diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/ClassHierarchyWithMergedConfigLevelOneTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/ClassHierarchyWithMergedConfigLevelOneTests.java index 1b62adbcbc..1272dad8ea 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/ClassHierarchyWithMergedConfigLevelOneTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/ClassHierarchyWithMergedConfigLevelOneTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat; @ContextConfiguration(name = "parent", classes = ClassHierarchyWithMergedConfigLevelOneTests.AppConfig.class),// @ContextConfiguration(name = "child", classes = ClassHierarchyWithMergedConfigLevelOneTests.UserConfig.class) // }) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class ClassHierarchyWithMergedConfigLevelOneTests { @Configuration diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/ClassHierarchyWithMergedConfigLevelTwoTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/ClassHierarchyWithMergedConfigLevelTwoTests.java index 94c9fea02f..61d0c79120 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/ClassHierarchyWithMergedConfigLevelTwoTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/ClassHierarchyWithMergedConfigLevelTwoTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @ExtendWith(SpringExtension.class) @ContextHierarchy(@ContextConfiguration(name = "child", classes = ClassHierarchyWithMergedConfigLevelTwoTests.OrderConfig.class)) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class ClassHierarchyWithMergedConfigLevelTwoTests extends ClassHierarchyWithMergedConfigLevelOneTests { @Configuration diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/ClassHierarchyWithOverriddenConfigLevelTwoTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/ClassHierarchyWithOverriddenConfigLevelTwoTests.java index 33d66b9759..e0641a9e52 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/ClassHierarchyWithOverriddenConfigLevelTwoTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/ClassHierarchyWithOverriddenConfigLevelTwoTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @ExtendWith(SpringExtension.class) @ContextHierarchy(@ContextConfiguration(name = "child", classes = ClassHierarchyWithOverriddenConfigLevelTwoTests.TestUserConfig.class, inheritLocations = false)) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class ClassHierarchyWithOverriddenConfigLevelTwoTests extends ClassHierarchyWithMergedConfigLevelOneTests { @Configuration diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/DirtiesContextWithContextHierarchyTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/DirtiesContextWithContextHierarchyTests.java index a26abdc1f5..1d0d9d1891 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/DirtiesContextWithContextHierarchyTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/DirtiesContextWithContextHierarchyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ import static org.assertj.core.api.Assertions.assertThat; @ContextConfiguration(classes = DirtiesContextWithContextHierarchyTests.ChildConfig.class) }) @TestMethodOrder(MethodOrderer.OrderAnnotation.class) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class DirtiesContextWithContextHierarchyTests { @Autowired diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/SingleTestClassWithSingleLevelContextHierarchyTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/SingleTestClassWithSingleLevelContextHierarchyTests.java index f4cef5cfd6..b4ad89a74f 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/SingleTestClassWithSingleLevelContextHierarchyTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/SingleTestClassWithSingleLevelContextHierarchyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @ExtendWith(SpringExtension.class) @ContextHierarchy(@ContextConfiguration) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class SingleTestClassWithSingleLevelContextHierarchyTests { @Configuration diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/SingleTestClassWithTwoLevelContextHierarchyAndMixedConfigTypesTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/SingleTestClassWithTwoLevelContextHierarchyAndMixedConfigTypesTests.java index 3e63632237..025fcb8aab 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/SingleTestClassWithTwoLevelContextHierarchyAndMixedConfigTypesTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/SingleTestClassWithTwoLevelContextHierarchyAndMixedConfigTypesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; @ContextHierarchy({ @ContextConfiguration(classes = SingleTestClassWithTwoLevelContextHierarchyAndMixedConfigTypesTests.ParentConfig.class), @ContextConfiguration("SingleTestClassWithTwoLevelContextHierarchyAndMixedConfigTypesTests-ChildConfig.xml") }) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class SingleTestClassWithTwoLevelContextHierarchyAndMixedConfigTypesTests { @Configuration diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/SingleTestClassWithTwoLevelContextHierarchyTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/SingleTestClassWithTwoLevelContextHierarchyTests.java index 0a24897ef0..e1056aaa64 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/SingleTestClassWithTwoLevelContextHierarchyTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/SingleTestClassWithTwoLevelContextHierarchyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; @ContextHierarchy({ @ContextConfiguration(classes = SingleTestClassWithTwoLevelContextHierarchyTests.ParentConfig.class), @ContextConfiguration(classes = SingleTestClassWithTwoLevelContextHierarchyTests.ChildConfig.class) }) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") public class SingleTestClassWithTwoLevelContextHierarchyTests { @Configuration diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelOneWithBareContextConfigurationInSubclassTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelOneWithBareContextConfigurationInSubclassTests.java index 377fab4a8c..00fac26163 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelOneWithBareContextConfigurationInSubclassTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelOneWithBareContextConfigurationInSubclassTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @ExtendWith(SpringExtension.class) @ContextHierarchy(@ContextConfiguration) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class TestHierarchyLevelOneWithBareContextConfigurationInSubclassTests { @Configuration diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelOneWithSingleLevelContextHierarchyTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelOneWithSingleLevelContextHierarchyTests.java index c93aeba76d..7e54952cbe 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelOneWithSingleLevelContextHierarchyTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelOneWithSingleLevelContextHierarchyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @ExtendWith(SpringExtension.class) @ContextHierarchy(@ContextConfiguration) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class TestHierarchyLevelOneWithSingleLevelContextHierarchyTests { @Configuration diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelTwoWithBareContextConfigurationInSubclassTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelTwoWithBareContextConfigurationInSubclassTests.java index fed405f131..cea9c46392 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelTwoWithBareContextConfigurationInSubclassTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelTwoWithBareContextConfigurationInSubclassTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @ExtendWith(SpringExtension.class) @ContextConfiguration -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class TestHierarchyLevelTwoWithBareContextConfigurationInSubclassTests extends TestHierarchyLevelOneWithBareContextConfigurationInSubclassTests { diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelTwoWithBareContextConfigurationInSuperclassTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelTwoWithBareContextConfigurationInSuperclassTests.java index 3504720b19..4b8224399e 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelTwoWithBareContextConfigurationInSuperclassTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelTwoWithBareContextConfigurationInSuperclassTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @ExtendWith(SpringExtension.class) @ContextHierarchy(@ContextConfiguration) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class TestHierarchyLevelTwoWithBareContextConfigurationInSuperclassTests extends TestHierarchyLevelOneWithBareContextConfigurationInSuperclassTests { diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelTwoWithSingleLevelContextHierarchyAndMixedConfigTypesTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelTwoWithSingleLevelContextHierarchyAndMixedConfigTypesTests.java index c653e5e7eb..10a9e69d56 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelTwoWithSingleLevelContextHierarchyAndMixedConfigTypesTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelTwoWithSingleLevelContextHierarchyAndMixedConfigTypesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @ExtendWith(SpringExtension.class) @ContextHierarchy(@ContextConfiguration) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class TestHierarchyLevelTwoWithSingleLevelContextHierarchyAndMixedConfigTypesTests extends TestHierarchyLevelOneWithSingleLevelContextHierarchyTests { diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelTwoWithSingleLevelContextHierarchyTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelTwoWithSingleLevelContextHierarchyTests.java index 74108bd5ba..c5b4b53655 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelTwoWithSingleLevelContextHierarchyTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/standard/TestHierarchyLevelTwoWithSingleLevelContextHierarchyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @ExtendWith(SpringExtension.class) @ContextHierarchy(@ContextConfiguration) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class TestHierarchyLevelTwoWithSingleLevelContextHierarchyTests extends TestHierarchyLevelOneWithSingleLevelContextHierarchyTests { diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/ControllerIntegrationTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/ControllerIntegrationTests.java index 0e08ddcc24..6deda78f37 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/ControllerIntegrationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/ControllerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat; @ContextConfiguration(name = "root", classes = AppConfig.class), @ContextConfiguration(name = "dispatcher", classes = WebConfig.class) }) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class ControllerIntegrationTests { @Configuration diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/DispatcherWacRootWacEarTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/DispatcherWacRootWacEarTests.java index 9a7f556fbb..94fd288390 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/DispatcherWacRootWacEarTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/DispatcherWacRootWacEarTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @since 3.2.2 */ @ContextHierarchy(@ContextConfiguration) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") public class DispatcherWacRootWacEarTests extends RootWacEarTests { @Autowired diff --git a/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/RootWacEarTests.java b/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/RootWacEarTests.java index 75cca14a75..b0b2e22ffb 100644 --- a/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/RootWacEarTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/hierarchies/web/RootWacEarTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @WebAppConfiguration @ContextHierarchy(@ContextConfiguration) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class RootWacEarTests extends EarTests { @Configuration(proxyBeanMethods = false) diff --git a/spring-test/src/test/java/org/springframework/test/context/jdbc/PropertyPlaceholderSqlScriptsTests.java b/spring-test/src/test/java/org/springframework/test/context/jdbc/PropertyPlaceholderSqlScriptsTests.java index b82a700f24..f18d58c3bc 100644 --- a/spring-test/src/test/java/org/springframework/test/context/jdbc/PropertyPlaceholderSqlScriptsTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/jdbc/PropertyPlaceholderSqlScriptsTests.java @@ -38,7 +38,7 @@ class PropertyPlaceholderSqlScriptsTests { @ContextConfiguration(classes = PopulatedSchemaDatabaseConfig.class) @TestPropertySource(properties = "vendor = db1") @DirtiesContext - @DisabledInAotMode // ${vendor} does not get resolved during AOT processing + @DisabledInAotMode("${vendor} does not get resolved during AOT processing") class DatabaseOneTests extends AbstractTransactionalTests { @Test @@ -52,7 +52,7 @@ class PropertyPlaceholderSqlScriptsTests { @ContextConfiguration(classes = PopulatedSchemaDatabaseConfig.class) @TestPropertySource(properties = "vendor = db2") @DirtiesContext - @DisabledInAotMode // ${vendor} does not get resolved during AOT processing + @DisabledInAotMode("${vendor} does not get resolved during AOT processing") class DatabaseTwoTests extends AbstractTransactionalTests { @Test diff --git a/spring-test/src/test/java/org/springframework/test/context/junit/jupiter/nested/ContextHierarchyNestedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit/jupiter/nested/ContextHierarchyNestedTests.java index 21809f1ac9..6e0814c474 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit/jupiter/nested/ContextHierarchyNestedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit/jupiter/nested/ContextHierarchyNestedTests.java @@ -47,7 +47,7 @@ import static org.springframework.test.context.NestedTestConfiguration.Enclosing @ExtendWith(SpringExtension.class) @ContextHierarchy(@ContextConfiguration(classes = ParentConfig.class)) @NestedTestConfiguration(OVERRIDE) // since INHERIT is now the global default -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class ContextHierarchyNestedTests { private static final String FOO = "foo"; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit/jupiter/nested/TestExecutionListenersNestedTests.java b/spring-test/src/test/java/org/springframework/test/context/junit/jupiter/nested/TestExecutionListenersNestedTests.java index 0d94834ef8..9194161e86 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit/jupiter/nested/TestExecutionListenersNestedTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit/jupiter/nested/TestExecutionListenersNestedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,9 +47,7 @@ import static org.springframework.test.context.NestedTestConfiguration.Enclosing @ExtendWith(SpringExtension.class) @TestExecutionListeners(FooTestExecutionListener.class) @NestedTestConfiguration(OVERRIDE) // since INHERIT is now the global default -// Since this test class does not load an ApplicationContext, -// this test class simply is not supported for AOT processing. -@DisabledInAotMode +@DisabledInAotMode("Does not load an ApplicationContext and thus not supported for AOT processing") class TestExecutionListenersNestedTests { private static final String FOO = "foo"; @@ -83,7 +81,7 @@ class TestExecutionListenersNestedTests { @Nested @TestExecutionListeners(BarTestExecutionListener.class) - @DisabledInAotMode + @DisabledInAotMode("Does not load an ApplicationContext and thus not supported for AOT processing") class ConfigOverriddenByDefaultTests { @Test @@ -106,7 +104,7 @@ class TestExecutionListenersNestedTests { @Nested @NestedTestConfiguration(OVERRIDE) @TestExecutionListeners(BazTestExecutionListener.class) - @DisabledInAotMode + @DisabledInAotMode("Does not load an ApplicationContext and thus not supported for AOT processing") class DoubleNestedWithOverriddenConfigTests { @Test diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/ClassLevelDisabledSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/ClassLevelDisabledSpringRunnerTests.java index 1e6762a7fe..60938afcb5 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/ClassLevelDisabledSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/ClassLevelDisabledSpringRunnerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,9 +34,7 @@ import static org.assertj.core.api.Assertions.fail; @RunWith(SpringRunner.class) @TestExecutionListeners(ClassLevelDisabledSpringRunnerTests.CustomTestExecutionListener.class) @IfProfileValue(name = "ClassLevelDisabledSpringRunnerTests.profile_value.name", value = "enigmaX") -// Since Spring test's AOT processing support does not evaluate @IfProfileValue, -// this test class simply is not supported for AOT processing. -@DisabledInAotMode +@DisabledInAotMode("@IfProfileValue is not supported for AOT processing") public class ClassLevelDisabledSpringRunnerTests { @Test diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/EnabledAndIgnoredSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/EnabledAndIgnoredSpringRunnerTests.java index bb8c8ac359..52cbface38 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/EnabledAndIgnoredSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/EnabledAndIgnoredSpringRunnerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,9 +48,7 @@ import static org.assertj.core.api.Assertions.fail; */ @RunWith(SpringRunner.class) @TestExecutionListeners({}) -// Since this test class does not load an ApplicationContext, -// this test class simply is not supported for AOT processing. -@DisabledInAotMode +@DisabledInAotMode("Does not load an ApplicationContext and thus not supported for AOT processing") public class EnabledAndIgnoredSpringRunnerTests { protected static final String NAME = "EnabledAndIgnoredSpringRunnerTests.profile_value.name"; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/HardCodedProfileValueSourceSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/HardCodedProfileValueSourceSpringRunnerTests.java index d75577697f..7c5fec7dc6 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/HardCodedProfileValueSourceSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/HardCodedProfileValueSourceSpringRunnerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,8 +37,7 @@ import org.springframework.test.context.aot.DisabledInAotMode; * @see EnabledAndIgnoredSpringRunnerTests */ @ProfileValueSourceConfiguration(HardCodedProfileValueSourceSpringRunnerTests.HardCodedProfileValueSource.class) -// Since EnabledAndIgnoredSpringRunnerTests is disabled in AOT mode, this test class must be also. -@DisabledInAotMode +@DisabledInAotMode("Because EnabledAndIgnoredSpringRunnerTests is disabled in AOT mode") public class HardCodedProfileValueSourceSpringRunnerTests extends EnabledAndIgnoredSpringRunnerTests { @BeforeClass diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit47ClassRunnerRuleTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit47ClassRunnerRuleTests.java index d7a46ce24c..92005176dc 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit47ClassRunnerRuleTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/SpringJUnit47ClassRunnerRuleTests.java @@ -37,9 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @RunWith(SpringRunner.class) @TestExecutionListeners({}) -// Since this test class does not load an ApplicationContext, -// this test class simply is not supported for AOT processing. -@DisabledInAotMode +@DisabledInAotMode("Does not load an ApplicationContext and thus not supported for AOT processing") public class SpringJUnit47ClassRunnerRuleTests { @Rule diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/StandardJUnit4FeaturesSpringRunnerTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/StandardJUnit4FeaturesSpringRunnerTests.java index bf995fe8bb..0535382b25 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/StandardJUnit4FeaturesSpringRunnerTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/StandardJUnit4FeaturesSpringRunnerTests.java @@ -38,9 +38,7 @@ import org.springframework.test.context.aot.DisabledInAotMode; */ @RunWith(SpringRunner.class) @TestExecutionListeners({}) -// Since this test class does not load an ApplicationContext, -// this test class simply is not supported for AOT processing. -@DisabledInAotMode +@DisabledInAotMode("Does not load an ApplicationContext and thus not supported for AOT processing") public class StandardJUnit4FeaturesSpringRunnerTests extends StandardJUnit4FeaturesTests { /* All tests are in the parent class... */ diff --git a/spring-test/src/test/java/org/springframework/test/context/transaction/ejb/CommitForRequiredEjbTxDaoTests.java b/spring-test/src/test/java/org/springframework/test/context/transaction/ejb/CommitForRequiredEjbTxDaoTests.java index e41f0ab346..70571386e6 100644 --- a/spring-test/src/test/java/org/springframework/test/context/transaction/ejb/CommitForRequiredEjbTxDaoTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/transaction/ejb/CommitForRequiredEjbTxDaoTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ import org.springframework.test.context.transaction.ejb.dao.RequiredEjbTxTestEnt */ @ContextConfiguration("required-tx-config.xml") @Commit -@DisabledInAotMode // @EJB is not supported in Spring AOT +@DisabledInAotMode("@EJB is not supported in Spring AOT") class CommitForRequiredEjbTxDaoTests extends AbstractEjbTxDaoTests { /* test methods in superclass */ diff --git a/spring-test/src/test/java/org/springframework/test/context/transaction/ejb/CommitForRequiresNewEjbTxDaoTests.java b/spring-test/src/test/java/org/springframework/test/context/transaction/ejb/CommitForRequiresNewEjbTxDaoTests.java index f99dfd882e..cea563d599 100644 --- a/spring-test/src/test/java/org/springframework/test/context/transaction/ejb/CommitForRequiresNewEjbTxDaoTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/transaction/ejb/CommitForRequiresNewEjbTxDaoTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ import org.springframework.test.context.transaction.ejb.dao.RequiresNewEjbTxTest */ @ContextConfiguration("requires-new-tx-config.xml") @Commit -@DisabledInAotMode // @EJB is not supported in Spring AOT +@DisabledInAotMode("@EJB is not supported in Spring AOT") class CommitForRequiresNewEjbTxDaoTests extends AbstractEjbTxDaoTests { /* test methods in superclass */ diff --git a/spring-test/src/test/java/org/springframework/test/context/transaction/ejb/RollbackForRequiredEjbTxDaoTests.java b/spring-test/src/test/java/org/springframework/test/context/transaction/ejb/RollbackForRequiredEjbTxDaoTests.java index 7b5169be77..e1adabdd8d 100644 --- a/spring-test/src/test/java/org/springframework/test/context/transaction/ejb/RollbackForRequiredEjbTxDaoTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/transaction/ejb/RollbackForRequiredEjbTxDaoTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @since 4.0.1 */ @Rollback -@DisabledInAotMode // @EJB is not supported in Spring AOT +@DisabledInAotMode("@EJB is not supported in Spring AOT") class RollbackForRequiredEjbTxDaoTests extends CommitForRequiredEjbTxDaoTests { /** diff --git a/spring-test/src/test/java/org/springframework/test/context/transaction/ejb/RollbackForRequiresNewEjbTxDaoTests.java b/spring-test/src/test/java/org/springframework/test/context/transaction/ejb/RollbackForRequiresNewEjbTxDaoTests.java index deea771c16..a68fc8a94b 100644 --- a/spring-test/src/test/java/org/springframework/test/context/transaction/ejb/RollbackForRequiresNewEjbTxDaoTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/transaction/ejb/RollbackForRequiresNewEjbTxDaoTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ import org.springframework.test.context.transaction.TransactionalTestExecutionLi * @since 4.0.1 */ @Rollback -@DisabledInAotMode // @EJB is not supported in Spring AOT +@DisabledInAotMode("@EJB is not supported in Spring AOT") class RollbackForRequiresNewEjbTxDaoTests extends CommitForRequiresNewEjbTxDaoTests { /* test methods in superclass */ diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/AsyncControllerJavaConfigTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/AsyncControllerJavaConfigTests.java index 53dc815f1a..40b74b7861 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/AsyncControllerJavaConfigTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/AsyncControllerJavaConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,7 +56,7 @@ import static org.mockito.Mockito.mock; @ExtendWith(SpringExtension.class) @WebAppConfiguration @ContextHierarchy(@ContextConfiguration(classes = AsyncControllerJavaConfigTests.WebConfig.class)) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") public class AsyncControllerJavaConfigTests { @Autowired diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/JavaConfigTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/JavaConfigTests.java index 4e0a436987..2d24a331b9 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/JavaConfigTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/JavaConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,7 +56,7 @@ import static org.mockito.Mockito.mock; @ContextConfiguration(classes = JavaConfigTests.RootConfig.class), @ContextConfiguration(classes = JavaConfigTests.WebConfig.class) }) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") class JavaConfigTests { @Autowired diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/WebAppResourceTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/WebAppResourceTests.java index a4b60648b2..fb748a0d62 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/WebAppResourceTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/WebAppResourceTests.java @@ -48,7 +48,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @ContextConfiguration("../../context/root-context.xml"), @ContextConfiguration("../../context/servlet-context.xml") }) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") public class WebAppResourceTests { @Autowired diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/XmlConfigTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/XmlConfigTests.java index f2630c427a..7e8a4c47eb 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/XmlConfigTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/XmlConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ import static org.mockito.BDDMockito.given; @ContextConfiguration("../../context/root-context.xml"), @ContextConfiguration("../../context/servlet-context.xml") }) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") public class XmlConfigTests { @Autowired diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/AsyncControllerJavaConfigTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/AsyncControllerJavaConfigTests.java index e6fea3f606..4a55f251fc 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/AsyncControllerJavaConfigTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/AsyncControllerJavaConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @ExtendWith(SpringExtension.class) @WebAppConfiguration @ContextHierarchy(@ContextConfiguration(classes = AsyncControllerJavaConfigTests.WebConfig.class)) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") public class AsyncControllerJavaConfigTests { @Autowired diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/JavaConfigTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/JavaConfigTests.java index 4ad707c7ea..06e7869c02 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/JavaConfigTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/JavaConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @ContextConfiguration(classes = RootConfig.class), @ContextConfiguration(classes = WebConfig.class) }) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") public class JavaConfigTests { @Autowired diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/WebAppResourceTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/WebAppResourceTests.java index c12826aeb1..ddfd117360 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/WebAppResourceTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/WebAppResourceTests.java @@ -49,7 +49,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @ContextConfiguration("root-context.xml"), @ContextConfiguration("servlet-context.xml") }) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") public class WebAppResourceTests { @Autowired diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/XmlConfigTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/XmlConfigTests.java index 53a3d460ea..9792f91976 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/XmlConfigTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/XmlConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @ContextConfiguration("root-context.xml"), @ContextConfiguration("servlet-context.xml") }) -@DisabledInAotMode // @ContextHierarchy is not supported in AOT. +@DisabledInAotMode("@ContextHierarchy is not supported in AOT") public class XmlConfigTests { @Autowired