mirror of
https://gitee.com/dcren/initializr.git
synced 2025-04-05 17:38:06 +08:00
Polish
This commit is contained in:
parent
fad1d14bf0
commit
a049d6e4fc
@ -98,8 +98,10 @@ class SourceCodeProjectGenerationConfigurationTests {
|
||||
this.projectTester.generate(description, (context) -> {
|
||||
ServletInitializerContributor bean = context
|
||||
.getBean(ServletInitializerContributor.class);
|
||||
SourceCode sourceCode = mock(SourceCode.class);
|
||||
CompilationUnit compilationUnit = mock(CompilationUnit.class);
|
||||
SourceCode<TypeDeclaration, CompilationUnit<TypeDeclaration>> sourceCode = mock(
|
||||
SourceCode.class);
|
||||
CompilationUnit<TypeDeclaration> compilationUnit = mock(
|
||||
CompilationUnit.class);
|
||||
given(sourceCode.createCompilationUnit(any(), any()))
|
||||
.willReturn(compilationUnit);
|
||||
TypeDeclaration typeDeclaration = mock(TypeDeclaration.class);
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package io.spring.initializr.generator.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -74,17 +75,18 @@ class IndentingWriterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void customIndentStrategyIsUsed() {
|
||||
IndentingWriter customIndentingWriter = new IndentingWriter(this.stringWriter,
|
||||
new SimpleIndentStrategy("\t"));
|
||||
customIndentingWriter.println("a");
|
||||
customIndentingWriter.indented(() -> {
|
||||
customIndentingWriter.println("b");
|
||||
void customIndentStrategyIsUsed() throws IOException {
|
||||
try (IndentingWriter customIndentingWriter = new IndentingWriter(
|
||||
this.stringWriter, new SimpleIndentStrategy("\t"))) {
|
||||
customIndentingWriter.println("a");
|
||||
customIndentingWriter.indented(() -> {
|
||||
customIndentingWriter.print("c");
|
||||
customIndentingWriter.println("e");
|
||||
customIndentingWriter.println("b");
|
||||
customIndentingWriter.indented(() -> {
|
||||
customIndentingWriter.print("c");
|
||||
customIndentingWriter.println("e");
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
assertThat(this.stringWriter.toString()).isEqualTo("a\n\tb\n\t\tce\n");
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ import io.spring.initializr.generator.project.ProjectGenerationException;
|
||||
/**
|
||||
* Base tester for project generation.
|
||||
*
|
||||
* @param <SELF> concrete type of the tester
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public abstract class AbstractProjectGenerationTester<SELF extends AbstractProjectGenerationTester<SELF>> {
|
||||
|
@ -196,7 +196,6 @@ class InitializrMetadataBuilderTests {
|
||||
InitializrMetadata metadata = InitializrMetadataBuilder
|
||||
.fromInitializrProperties(config)
|
||||
.withInitializrProperties(forceSslConfig, true).build();
|
||||
InitializrConfiguration.Env defaultEnv = new InitializrConfiguration().getEnv();
|
||||
InitializrConfiguration.Env actualEnv = metadata.getConfiguration().getEnv();
|
||||
assertThat(actualEnv.isForceSsl()).isEqualTo(true);
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.spring.initializr.generator.buildsystem.Build;
|
||||
import io.spring.initializr.generator.buildsystem.BuildItemResolver;
|
||||
import io.spring.initializr.generator.project.DefaultProjectAssetGenerator;
|
||||
import io.spring.initializr.generator.project.ProjectAssetGenerator;
|
||||
@ -201,7 +200,6 @@ public class ProjectGenerationInvoker {
|
||||
|
||||
private void publishProjectGeneratedEvent(ProjectRequest request,
|
||||
ProjectGenerationContext context) {
|
||||
Build build = context.getBeanProvider(Build.class).getIfAvailable();
|
||||
InitializrMetadata metadata = context.getBean(InitializrMetadata.class);
|
||||
ProjectGeneratedEvent event = new ProjectGeneratedEvent(request, metadata);
|
||||
this.eventPublisher.publishEvent(event);
|
||||
|
Loading…
Reference in New Issue
Block a user