use of org.gradle.testkit.runner.BuildResult in project spring-boot by spring-projects.
the class BootRunIntegrationTests method classesFromASecondarySourceSetCanBeOnTheClasspath.
@TestTemplate
void classesFromASecondarySourceSetCanBeOnTheClasspath() throws IOException {
File output = new File(this.gradleBuild.getProjectDir(), "src/secondary/java/com/example/bootrun/main");
output.mkdirs();
FileSystemUtils.copyRecursively(new File("src/test/java/com/example/bootrun/main"), output);
BuildResult result = this.gradleBuild.build("bootRun");
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.getOutput()).contains("com.example.bootrun.main.CustomMainClass");
}
use of org.gradle.testkit.runner.BuildResult in project spring-boot by spring-projects.
the class BootRunIntegrationTests method jarTypeFilteringIsAppliedToTheClasspath.
@TestTemplate
void jarTypeFilteringIsAppliedToTheClasspath() throws IOException {
copyClasspathApplication();
File flatDirRepository = new File(this.gradleBuild.getProjectDir(), "repository");
createDependenciesStarterJar(new File(flatDirRepository, "starter.jar"));
createStandardJar(new File(flatDirRepository, "standard.jar"));
BuildResult result = this.gradleBuild.build("bootRun");
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.getOutput()).contains("standard.jar").doesNotContain("starter.jar");
}
use of org.gradle.testkit.runner.BuildResult in project spring-boot by spring-projects.
the class JavaPluginActionIntegrationTests method additionalMetadataLocationsConfiguredWhenProcessorIsPresent.
@TestTemplate
void additionalMetadataLocationsConfiguredWhenProcessorIsPresent() throws IOException {
createMinimalMainSource();
File libs = new File(this.gradleBuild.getProjectDir(), "libs");
libs.mkdirs();
new JarOutputStream(new FileOutputStream(new File(libs, "spring-boot-configuration-processor-1.2.3.jar"))).close();
BuildResult result = this.gradleBuild.build("compileJava");
assertThat(result.task(":compileJava").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.getOutput()).contains("compileJava compiler args: [-parameters, -Aorg.springframework.boot." + "configurationprocessor.additionalMetadataLocations=" + new File(this.gradleBuild.getProjectDir(), "src/main/resources").getCanonicalPath());
}
use of org.gradle.testkit.runner.BuildResult in project spring-boot by spring-projects.
the class JavaPluginActionIntegrationTests method additionalMetadataLocationsNotConfiguredWhenProcessorIsAbsent.
@TestTemplate
void additionalMetadataLocationsNotConfiguredWhenProcessorIsAbsent() throws IOException {
createMinimalMainSource();
BuildResult result = this.gradleBuild.build("compileJava");
assertThat(result.task(":compileJava").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.getOutput()).contains("compileJava compiler args: [-parameters]");
}
use of org.gradle.testkit.runner.BuildResult in project spring-boot by spring-projects.
the class JavaPluginActionIntegrationTests method assembleRunsBootJarAndJar.
@TestTemplate
void assembleRunsBootJarAndJar() {
BuildResult result = this.gradleBuild.build("assemble");
assertThat(result.task(":bootJar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.task(":jar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
File buildLibs = new File(this.gradleBuild.getProjectDir(), "build/libs");
assertThat(buildLibs.listFiles()).containsExactlyInAnyOrder(new File(buildLibs, this.gradleBuild.getProjectDir().getName() + ".jar"), new File(buildLibs, this.gradleBuild.getProjectDir().getName() + "-plain.jar"));
}
Aggregations