Break dependency between TestCompiler and AOT
This commit improves `TestCompiler` with a `with` function that allows to customize a test compiler instance. Rather than `TestCompiler` knowing about `TestGenerationContext`, the latter implements the function so that it can be passed as is. See gh-29175
This commit is contained in:
@@ -109,7 +109,7 @@ class PersistenceManagedTypesBeanRegistrationAotProcessorTests {
|
||||
TestGenerationContext generationContext = new TestGenerationContext();
|
||||
generator.processAheadOfTime(applicationContext, generationContext);
|
||||
generationContext.writeGeneratedContent();
|
||||
TestCompiler.forSystem().withFiles(generationContext.getGeneratedFiles()).compile(compiled ->
|
||||
TestCompiler.forSystem().with(generationContext).compile(compiled ->
|
||||
result.accept(compiled.getInstance(ApplicationContextInitializer.class), compiled));
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ class PersistenceAnnotationBeanPostProcessorAotContributionTests {
|
||||
BeanRegistrationCode beanRegistrationCode = mock(BeanRegistrationCode.class);
|
||||
contribution.applyTo(generationContext, beanRegistrationCode);
|
||||
generationContext.writeGeneratedContent();
|
||||
TestCompiler.forSystem().withFiles(generationContext.getGeneratedFiles())
|
||||
TestCompiler.forSystem().with(generationContext)
|
||||
.compile(compiled -> result.accept(new Invoker(compiled), compiled));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user