Class TestGenerationContext
java.lang.Object
org.springframework.aot.generate.DefaultGenerationContext
org.springframework.aot.test.generate.TestGenerationContext
- All Implemented Interfaces:
 Function<TestCompiler,,TestCompiler> UnaryOperator<TestCompiler>,GenerationContext
public class TestGenerationContext
extends DefaultGenerationContext
implements UnaryOperator<TestCompiler>
GenerationContext test implementation that uses
 InMemoryGeneratedFiles and can configure a TestCompiler
 instance.- Since:
 - 6.0
 - Author:
 - Stephane Nicoll, Sam Brannen
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.springframework.javapoet.ClassNameThe default test targetClassName. - 
Constructor Summary
ConstructorsConstructorDescriptionCreate an instance usingTEST_TARGETas thetarget.TestGenerationContext(Class<?> target) Create an instance using the specifiedtarget.TestGenerationContext(ClassNameGenerator classNameGenerator) Create an instance using the specifiedClassNameGenerator.TestGenerationContext(org.springframework.javapoet.ClassName target) Create an instance using the specifiedtarget. - 
Method Summary
Modifier and TypeMethodDescriptionapply(TestCompiler testCompiler) Configure the specifiedTestCompilerwith the state of this context.Get theGeneratedFilesused by the context.Methods inherited from class org.springframework.aot.generate.DefaultGenerationContext
getGeneratedClasses, getRuntimeHints, withName, writeGeneratedContent 
- 
Field Details
- 
TEST_TARGET
public static final org.springframework.javapoet.ClassName TEST_TARGETThe default test targetClassName. 
 - 
 - 
Constructor Details
- 
TestGenerationContext
Create an instance using the specifiedClassNameGenerator.- Parameters:
 classNameGenerator- the class name generator to use
 - 
TestGenerationContext
public TestGenerationContext(org.springframework.javapoet.ClassName target) Create an instance using the specifiedtarget.- Parameters:
 target- the default target class name to use
 - 
TestGenerationContext
Create an instance using the specifiedtarget.- Parameters:
 target- the default target class to use
 - 
TestGenerationContext
public TestGenerationContext()Create an instance usingTEST_TARGETas thetarget. 
 - 
 - 
Method Details
- 
getGeneratedFiles
Description copied from interface:GenerationContextGet theGeneratedFilesused by the context.Used to write resource, java source, or class bytecode files.
- Specified by:
 getGeneratedFilesin interfaceGenerationContext- Overrides:
 getGeneratedFilesin classDefaultGenerationContext- Returns:
 - the generated files
 
 - 
apply
Configure the specifiedTestCompilerwith the state of this context.- Specified by:
 applyin interfaceFunction<TestCompiler,TestCompiler> - Parameters:
 testCompiler- the compiler to configure- Returns:
 - a new 
TestCompilerinstance configured with the generated files - See Also:
 
 
 -