Fix test to create correct type of child context

Closes gh-32002
This commit is contained in:
Andy Wilkinson 2022-08-08 14:18:40 +01:00
parent 846340ad62
commit fb2f7c1e38
1 changed files with 3 additions and 1 deletions

View File

@ -25,6 +25,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.aot.AotDetector;
import org.springframework.aot.test.generator.compile.CompileWithTargetClassAccess;
import org.springframework.aot.test.generator.compile.TestCompiler;
import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration;
@ -86,7 +87,8 @@ class ChildManagementContextInitializerAotTests {
.getInstance(ApplicationContextInitializer.class, className.toString());
initializer.initialize(freshApplicationContext);
assertThat(output).satisfies(numberOfOccurrences("Tomcat started on port", 0));
freshApplicationContext.refresh();
TestPropertyValues.of(AotDetector.AOT_ENABLED + "=true")
.applyToSystemProperties(freshApplicationContext::refresh);
assertThat(output).satisfies(numberOfOccurrences("Tomcat started on port", 2));
});
});