Class SpringTestHelper

java.lang.Object
it.tidalwave.util.test.BaseTestHelper
it.tidalwave.util.test.SpringTestHelper

public class SpringTestHelper extends BaseTestHelper
A facility that provides some common tasks for testing, such as creating a Spring context and manipulating files.
Since:
3.2-ALPHA-18
Author:
Fabrizio Giudici
  • Constructor Details

    • SpringTestHelper

      public SpringTestHelper(@Nonnull Object test)
  • Method Details

    • createSpringContext

      @Nonnull public org.springframework.context.ApplicationContext createSpringContext(@Nonnull String... configurationFiles)
      Creates a Spring context configured with the given files. A further configuration file is appended, named test-class-simple-name/TestBeans.xml.
      Parameters:
      configurationFiles - the configuration files
      Returns:
      the Spring ApplicationContext
    • createSpringContext

      @Nonnull public org.springframework.context.ApplicationContext createSpringContext(@Nonnull Map<String,Object> properties, @Nonnull String... configurationFiles)
      Creates a Spring context configured with the given files. A further configuration file is appended, named test-class-simple-name/TestBeans.xml.
      Parameters:
      properties - the properties
      configurationFiles - the configuration files
      Returns:
      the Spring ApplicationContext
    • createSpringContext

      @Nonnull public org.springframework.context.ApplicationContext createSpringContext(@Nonnull Consumer<? super org.springframework.context.support.GenericApplicationContext> modifier, @Nonnull String... configurationFiles)
      Creates a Spring context configured with the given files. A further configuration file is appended, named test-class-simple-name/TestBeans.xml.
      Parameters:
      modifier - a processor to modify the contents of the context
      configurationFiles - the configuration files
      Returns:
      the Spring ApplicationContext
    • createSpringContext

      @Nonnull public org.springframework.context.ApplicationContext createSpringContext(@Nonnull Map<String,Object> properties, @Nonnull Consumer<? super org.springframework.context.support.GenericApplicationContext> modifier, @Nonnull String... configurationFiles)
      Creates a Spring context configured with the given files. A further configuration file is appended, named test-class-simple-name/TestBeans.xml.
      Parameters:
      properties - the properties
      modifier - a processor to modify the contents of the context
      configurationFiles - the configuration files
      Returns:
      the Spring ApplicationContext