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 c2d8bcfce3..40520e8eb5 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 @@ -17,6 +17,7 @@ package org.springframework.test.context.env; import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.aot.DisabledInAotMode; /** * Integration tests for {@link TestPropertySource @TestPropertySource} @@ -26,5 +27,7 @@ import org.springframework.test.context.TestPropertySource; * @since 4.1 */ @TestPropertySource("explicit.properties") +// Since ExplicitPropertiesFileTestPropertySourceTests is disabled in AOT mode, this class must be also. +@DisabledInAotMode 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 0a47f785f4..51fb4cb3c5 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 @@ -22,6 +22,7 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Nested; import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.aot.DisabledInAotMode; import org.springframework.util.ClassUtils; /** @@ -34,6 +35,9 @@ 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 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 b0c9593453..4b19c4241d 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 @@ -17,6 +17,7 @@ package org.springframework.test.context.env; import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.aot.DisabledInAotMode; /** * Integration tests for {@link TestPropertySource @TestPropertySource} @@ -26,6 +27,8 @@ import org.springframework.test.context.TestPropertySource; * @author Sam Brannen * @since 4.1 */ +// Since ExplicitPropertiesFileTestPropertySourceTests is disabled in AOT mode, this class must be also. +@DisabledInAotMode 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 ffb0484a59..6717fb46cb 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 @@ -19,6 +19,7 @@ package org.springframework.test.context.env; import org.junit.jupiter.api.Test; import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.aot.DisabledInAotMode; import static org.assertj.core.api.Assertions.assertThat; @@ -31,6 +32,8 @@ 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 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 a6f6f9a0c7..be4f2db36a 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 @@ -19,6 +19,7 @@ package org.springframework.test.context.env; import org.junit.jupiter.api.Test; import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.aot.DisabledInAotMode; import static org.assertj.core.api.Assertions.assertThat; @@ -30,6 +31,8 @@ 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 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 687f348987..14abb3a1ab 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 @@ -17,6 +17,7 @@ package org.springframework.test.context.env.subpackage; import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.aot.DisabledInAotMode; import org.springframework.test.context.env.ExplicitPropertiesFileInClasspathTestPropertySourceTests; /** @@ -27,6 +28,8 @@ 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 class SubpackageInheritedRelativePathPropertiesFileTestPropertySourceTests extends ExplicitPropertiesFileInClasspathTestPropertySourceTests { 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 78e1ed3c04..b9d50c3510 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 @@ -23,6 +23,7 @@ import org.springframework.test.annotation.IfProfileValue; import org.springframework.test.context.TestContext; import org.springframework.test.context.TestExecutionListener; import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.aot.DisabledInAotMode; import static org.assertj.core.api.Assertions.fail; @@ -33,6 +34,9 @@ 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 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 ef6c647f25..bb8c8ac359 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 @@ -26,6 +26,7 @@ import org.springframework.test.annotation.IfProfileValue; import org.springframework.test.annotation.ProfileValueSource; import org.springframework.test.annotation.ProfileValueSourceConfiguration; import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.aot.DisabledInAotMode; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; @@ -47,6 +48,9 @@ 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 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 d7e8e7d28c..503d4d9cbe 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 @@ -20,6 +20,7 @@ import org.junit.BeforeClass; import org.springframework.test.annotation.ProfileValueSource; import org.springframework.test.annotation.ProfileValueSourceConfiguration; +import org.springframework.test.context.aot.DisabledInAotMode; /** *

@@ -36,6 +37,8 @@ import org.springframework.test.annotation.ProfileValueSourceConfiguration; * @see EnabledAndIgnoredSpringRunnerTests */ @ProfileValueSourceConfiguration(HardCodedProfileValueSourceSpringRunnerTests.HardCodedProfileValueSource.class) +// Since EnabledAndIgnoredSpringRunnerTests is disabled in AOT mode, this test class must be also. +@DisabledInAotMode 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 b0d4e267b6..d7a46ce24c 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 @@ -22,6 +22,7 @@ import org.junit.rules.TestName; import org.junit.runner.RunWith; import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.aot.DisabledInAotMode; import static org.assertj.core.api.Assertions.assertThat; @@ -36,6 +37,9 @@ 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 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 3390b772a9..6e87754f54 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 @@ -19,6 +19,7 @@ package org.springframework.test.context.junit4; import org.junit.runner.RunWith; import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.aot.DisabledInAotMode; /** *

@@ -37,6 +38,9 @@ import org.springframework.test.context.TestExecutionListeners; */ @RunWith(SpringRunner.class) @TestExecutionListeners({}) +// Since this test class does not load an ApplicationContext, +// this test class simply is not supported for AOT processing. +@DisabledInAotMode public class StandardJUnit4FeaturesSpringRunnerTests extends StandardJUnit4FeaturesTests { /* All tests are in the parent class... */