Class AbstractCustomTemplateIntegrationTest

java.lang.Object
com.graphql_java_generator.plugin.compilation_tests.AbstractCustomTemplateIntegrationTest

public abstract class AbstractCustomTemplateIntegrationTest extends Object
Base integration test for Custom templates scenario Offers methods to assert customized code validation
Author:
ggomez
  • Field Details

    • CUSTOMIZED_CODE_FIRST_LINE

      protected static final String CUSTOMIZED_CODE_FIRST_LINE
      See Also:
    • ctx

      protected org.springframework.context.support.AbstractApplicationContext ctx
    • generateCodeDocumentParser

      protected com.graphql_java_generator.plugin.DocumentParser generateCodeDocumentParser
    • codeGenerator

      protected com.graphql_java_generator.plugin.Generator codeGenerator
    • compilationTestHelper

      protected CompilationTestHelper compilationTestHelper
    • graphqlTestHelper

      protected GraphqlTestHelper graphqlTestHelper
    • mavenTestHelper

      protected MavenTestHelper mavenTestHelper
    • configuration

      protected com.graphql_java_generator.plugin.conf.GraphQLConfiguration configuration
  • Constructor Details

    • AbstractCustomTemplateIntegrationTest

      public AbstractCustomTemplateIntegrationTest(Class<?> springConfClass)
  • Method Details

    • assertCustomTemplateGeneration

      protected void assertCustomTemplateGeneration(File sourcesDirectory)
      Helper method that validates that given dir contains files generated with custom templates Custom template file are identified by it's first line. It's value is \/** This template is custom **\/
      Parameters:
      generatedSourcesDir -
    • doAdditionalChecks

      protected void doAdditionalChecks() throws Exception
      Throws:
      Exception
    • loadGeneratedClass

      protected Class<?> loadGeneratedClass(String simpleClassname, com.graphql_java_generator.plugin.compilation_tests.AbstractIntegrationTest.FileType fileType) throws Exception
      Loads the given class from the generated files. This method is used to load the class, and apply java reflexion to check the generated code.
      Parameters:
      simpleClassname - The name of the generated class, without the package, for instance "QueryController"
      fileType -
      Returns:
      Throws:
      Exception
    • getURLClassLoader

      protected URLClassLoader getURLClassLoader() throws Exception
      Throws:
      Exception