Class AbstractProjectGenerationTester<SELF extends AbstractProjectGenerationTester<SELF>>
java.lang.Object
io.spring.initializr.generator.test.project.AbstractProjectGenerationTester<SELF>
- Type Parameters:
SELF- concrete type of the tester
- Direct Known Subclasses:
ProjectAssetTester, ProjectGeneratorTester
public abstract class AbstractProjectGenerationTester<SELF extends AbstractProjectGenerationTester<SELF>>
extends Object
Base tester for project generation.
- Author:
- Stephane Nicoll
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interface -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedAbstractProjectGenerationTester(Map<Class<?>, Supplier<?>> beanDefinitions, Consumer<ProjectGenerationContext> contextInitializer, Consumer<MutableProjectDescription> descriptionCustomizer) -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> TinvokeProjectGeneration(MutableProjectDescription description, AbstractProjectGenerationTester.ProjectGenerationInvoker<T> invoker) Customize the description and invoke the project generation.protected abstract SELFnewInstance(Map<Class<?>, Supplier<?>> beanDefinitions, Consumer<ProjectGenerationContext> contextInitializer, Consumer<MutableProjectDescription> descriptionCustomizer) Create a new instance with the given state.<T> SELFRegister a bean.withConfiguration(Class<?>... configurationClasses) Register the given configuration classes.Add a context initializer.withDescriptionCustomizer(Consumer<MutableProjectDescription> description) Add a description customizer.withDirectory(Path directory) Generate projects in a temporary directory within the given directory.Register anIndentingWriterFactorythat indents with four spaces.
-
Constructor Details
-
AbstractProjectGenerationTester
protected AbstractProjectGenerationTester(Map<Class<?>, Supplier<?>> beanDefinitions, Consumer<ProjectGenerationContext> contextInitializer, Consumer<MutableProjectDescription> descriptionCustomizer) -
AbstractProjectGenerationTester
protected AbstractProjectGenerationTester()
-
-
Method Details
-
newInstance
protected abstract SELF newInstance(Map<Class<?>, Supplier<?>> beanDefinitions, Consumer<ProjectGenerationContext> contextInitializer, Consumer<MutableProjectDescription> descriptionCustomizer) Create a new instance with the given state.- Parameters:
beanDefinitions- the bean definitionscontextInitializer- the context initializerdescriptionCustomizer- the description customizer- Returns:
- a new instance
-
withBean
-
withDirectory
-
withIndentingWriterFactory
Register anIndentingWriterFactorythat indents with four spaces.- Returns:
- a new instance
-
withConfiguration
-
withContextInitializer
Add a context initializer.- Parameters:
context- the context initializer- Returns:
- a new instance
-
withDescriptionCustomizer
Add a description customizer.- Parameters:
description- the description customizer- Returns:
- a new instance
-
invokeProjectGeneration
protected <T> T invokeProjectGeneration(MutableProjectDescription description, AbstractProjectGenerationTester.ProjectGenerationInvoker<T> invoker) Customize the description and invoke the project generation.- Type Parameters:
T- the type of the result- Parameters:
description- the descriptioninvoker- the invoker- Returns:
- the result of the project generation
-