### Question:
SpringBootApplicationSourceGenerator extends AbstractSourceGenerator { public void generate() throws GeneratorException { TypeSpec.Builder typeSpec = TypeSpec.classBuilder("Application") .addJavadoc(CodeBlock.builder() .add(GeneratorConstants.COPYRIGHT_JAVA) .build()) .addModifiers(Modifier.PUBLIC) .addAnnotation(SpringBootApplication.class) .addMethod(MethodSpec.methodBuilder("main") .addModifiers(Modifier.PUBLIC, Modifier.STATIC) .returns(void.class) .addParameter(String[].class, "args") .addStatement("$T.run(Application.class, args)", SpringApplication.class) .build()); JavaFile javaFile = JavaFile.builder(this.serverPackageJavaConform, typeSpec.build()) .build(); try { javaFile.writeTo(new File(directoryJava, "")); } catch (IOException e) { throw new GeneratorException("Unable to write generated file: >> Application.java << -> " + "exception: " + e.getMessage()); } } private  SpringBootApplicationSourceGenerator(SpringBootApplicationSourceGenerator.Builder builder); void generate(); static SpringBootApplicationSourceGenerator.Builder builder();  }### Answer:
@Test public void generateSpringBootApplicationClass() throws GeneratorException, IOException { SpringBootApplicationSourceGenerator generator = getSpringBootApplicationSourceGenerator(); generator.generate(); Path appPath = Files.find(projectFolder.getRoot().toPath(), Integer.MAX_VALUE, (filePath, fileAttr) -> fileAttr.isRegularFile()) .filter(path -> path.toFile().getName().equals("Application.java")) .findFirst() .orElse(null); assertNotNull(appPath); File appFile = appPath.toFile(); String appAsString = FileUtils.readFileToString(appFile); assertTrue(appAsString.contains("import org.springframework.boot.SpringApplication")); assertTrue(appAsString.contains("import org.springframework.boot.autoconfigure.SpringBootApplication;")); assertTrue(appAsString.contains("@SpringBootApplication")); assertTrue(appAsString.contains("public static void main(String[] args)")); assertTrue(appAsString.contains("SpringApplication.run(Application.class, args);")); }