diff --git a/spring-test/src/main/java/org/springframework/test/context/aot/TestContextAotGenerator.java b/spring-test/src/main/java/org/springframework/test/context/aot/TestContextAotGenerator.java index 4663a96a02e..7b430a9f412 100644 --- a/spring-test/src/main/java/org/springframework/test/context/aot/TestContextAotGenerator.java +++ b/spring-test/src/main/java/org/springframework/test/context/aot/TestContextAotGenerator.java @@ -204,7 +204,7 @@ public class TestContextAotGenerator { contextLoader.getClass().getName())); } - MergedContextConfiguration buildMergedContextConfiguration(Class testClass) { + private MergedContextConfiguration buildMergedContextConfiguration(Class testClass) { TestContextBootstrapper testContextBootstrapper = BootstrapUtils.resolveTestContextBootstrapper(testClass); // @BootstrapWith diff --git a/spring-test/src/test/java/org/springframework/test/context/aot/TestContextAotGeneratorTests.java b/spring-test/src/test/java/org/springframework/test/context/aot/TestContextAotGeneratorTests.java index b443098e9d3..1fab19cdadf 100644 --- a/spring-test/src/test/java/org/springframework/test/context/aot/TestContextAotGeneratorTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/aot/TestContextAotGeneratorTests.java @@ -37,7 +37,9 @@ import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.env.Profiles; import org.springframework.javapoet.ClassName; +import org.springframework.test.context.BootstrapUtils; import org.springframework.test.context.MergedContextConfiguration; +import org.springframework.test.context.TestContextBootstrapper; import org.springframework.test.context.aot.samples.basic.BasicSpringJupiterSharedConfigTests; import org.springframework.test.context.aot.samples.basic.BasicSpringJupiterTests; import org.springframework.test.context.aot.samples.basic.BasicSpringTestNGTests; @@ -103,7 +105,7 @@ class TestContextAotGeneratorTests extends AbstractAotTests { TestCompiler.forSystem().withFiles(generatedFiles).compile(ThrowingConsumer.of(compiled -> { AotTestMappings aotTestMappings = new AotTestMappings(); for (Class testClass : testClasses) { - MergedContextConfiguration mergedConfig = generator.buildMergedContextConfiguration(testClass); + MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass); ApplicationContextInitializer contextInitializer = aotTestMappings.getContextInitializer(testClass); assertThat(contextInitializer).isNotNull(); @@ -291,7 +293,7 @@ class TestContextAotGeneratorTests extends AbstractAotTests { List mappings = new ArrayList<>(); testClasses.forEach(testClass -> { DefaultGenerationContext generationContext = generator.createGenerationContext(testClass); - MergedContextConfiguration mergedConfig = generator.buildMergedContextConfiguration(testClass); + MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass); ClassName className = generator.processAheadOfTime(mergedConfig, generationContext); assertThat(className).isNotNull(); mappings.add(new Mapping(mergedConfig, className)); @@ -301,6 +303,11 @@ class TestContextAotGeneratorTests extends AbstractAotTests { } + private static MergedContextConfiguration buildMergedContextConfiguration(Class testClass) { + TestContextBootstrapper testContextBootstrapper = BootstrapUtils.resolveTestContextBootstrapper(testClass); + return testContextBootstrapper.buildMergedContextConfiguration(); + } + record Mapping(MergedContextConfiguration mergedConfig, ClassName className) { }