Class TestGenerationContext

java.lang.Object
org.springframework.aot.generate.DefaultGenerationContext
org.springframework.aot.test.generate.TestGenerationContext
All Implemented Interfaces:
Function<TestCompiler,TestCompiler>, UnaryOperator<TestCompiler>, org.springframework.aot.generate.GenerationContext

public class TestGenerationContext extends org.springframework.aot.generate.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 Details

    • TEST_TARGET

      public static final org.springframework.javapoet.ClassName TEST_TARGET
      The default test target ClassName.
  • Constructor Details

    • TestGenerationContext

      public TestGenerationContext(org.springframework.aot.generate.ClassNameGenerator classNameGenerator)
      Create an instance using the specified ClassNameGenerator.
      Parameters:
      classNameGenerator - the class name generator to use
    • TestGenerationContext

      public TestGenerationContext(org.springframework.javapoet.ClassName target)
      Create an instance using the specified target.
      Parameters:
      target - the default target class name to use
    • TestGenerationContext

      public TestGenerationContext(Class<?> target)
      Create an instance using the specified target.
      Parameters:
      target - the default target class to use
    • TestGenerationContext

      public TestGenerationContext()
      Create an instance using TEST_TARGET as the target.
  • Method Details

    • getGeneratedFiles

      public org.springframework.aot.generate.InMemoryGeneratedFiles getGeneratedFiles()
      Specified by:
      getGeneratedFiles in interface org.springframework.aot.generate.GenerationContext
      Overrides:
      getGeneratedFiles in class org.springframework.aot.generate.DefaultGenerationContext
    • apply

      public TestCompiler apply(TestCompiler testCompiler)
      Configure the specified TestCompiler with the state of this context.
      Specified by:
      apply in interface Function<TestCompiler,TestCompiler>
      Parameters:
      testCompiler - the compiler to configure
      Returns:
      a new TestCompiler instance configured with the generated files
      See Also: