Package it.tidalwave.util.test
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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class it.tidalwave.util.test.BaseTestHelper
BaseTestHelper.TestResource
-
-
Field Summary
-
Fields inherited from class it.tidalwave.util.test.BaseTestHelper
test
-
-
Constructor Summary
Constructors Constructor Description SpringTestHelper(java.lang.Object test)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.context.ApplicationContext
createSpringContext(java.lang.String... configurationFiles)
Creates a Spring context configured with the given files.org.springframework.context.ApplicationContext
createSpringContext(java.util.function.Consumer<? super org.springframework.context.support.GenericApplicationContext> modifier, java.lang.String... configurationFiles)
Creates a Spring context configured with the given files.org.springframework.context.ApplicationContext
createSpringContext(java.util.Map<java.lang.String,java.lang.Object> properties, java.lang.String... configurationFiles)
Creates a Spring context configured with the given files.org.springframework.context.ApplicationContext
createSpringContext(java.util.Map<java.lang.String,java.lang.Object> properties, java.util.function.Consumer<? super org.springframework.context.support.GenericApplicationContext> modifier, java.lang.String... configurationFiles)
Creates a Spring context configured with the given files.-
Methods inherited from class it.tidalwave.util.test.BaseTestHelper
readStringFromResource, resourceFileFor, testResourceFor
-
-
-
-
Method Detail
-
createSpringContext
@Nonnull public org.springframework.context.ApplicationContext createSpringContext(@Nonnull java.lang.String... configurationFiles)
Creates a Spring context configured with the given files. A further configuration file is appended, namedtest-class-simple-name/TestBeans.xml
.- Parameters:
configurationFiles
- the configuration files- Returns:
- the Spring
ApplicationContext
-
createSpringContext
@Nonnull public org.springframework.context.ApplicationContext createSpringContext(@Nonnull java.util.Map<java.lang.String,java.lang.Object> properties, @Nonnull java.lang.String... configurationFiles)
Creates a Spring context configured with the given files. A further configuration file is appended, namedtest-class-simple-name/TestBeans.xml
.- Parameters:
properties
- the propertiesconfigurationFiles
- the configuration files- Returns:
- the Spring
ApplicationContext
-
createSpringContext
@Nonnull public org.springframework.context.ApplicationContext createSpringContext(@Nonnull java.util.function.Consumer<? super org.springframework.context.support.GenericApplicationContext> modifier, @Nonnull java.lang.String... configurationFiles)
Creates a Spring context configured with the given files. A further configuration file is appended, namedtest-class-simple-name/TestBeans.xml
.- Parameters:
configurationFiles
- the configuration filesmodifier
- a processor to modify the contents of the context- Returns:
- the Spring
ApplicationContext
-
createSpringContext
@Nonnull public org.springframework.context.ApplicationContext createSpringContext(@Nonnull java.util.Map<java.lang.String,java.lang.Object> properties, @Nonnull java.util.function.Consumer<? super org.springframework.context.support.GenericApplicationContext> modifier, @Nonnull java.lang.String... configurationFiles)
Creates a Spring context configured with the given files. A further configuration file is appended, namedtest-class-simple-name/TestBeans.xml
.- Parameters:
properties
- the propertiesmodifier
- a processor to modify the contents of the contextconfigurationFiles
- the configuration files- Returns:
- the Spring
ApplicationContext
-
-