Reduce visibility of the Gradle plugin's test methods

See gh-19287
This commit is contained in:
Andy Wilkinson 2019-12-05 10:24:48 +00:00
parent a2451a4f29
commit 47b47c28a0
20 changed files with 115 additions and 116 deletions

View File

@ -29,7 +29,7 @@ import org.springframework.boot.gradle.testkit.GradleBuild;
* @author Jean-Baptiste Nizet
*/
@ExtendWith(GradleMultiDslExtension.class)
public class GettingStartedDocumentationTests {
class GettingStartedDocumentationTests {
GradleBuild gradleBuild;
@ -37,7 +37,7 @@ public class GettingStartedDocumentationTests {
// jar won't be there
@TestTemplate
public void typicalPluginsAppliesExceptedPlugins() {
void typicalPluginsAppliesExceptedPlugins() {
this.gradleBuild.script("src/main/gradle/getting-started/typical-plugins").build("verify");
}

View File

@ -36,19 +36,19 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Jean-Baptiste Nizet
*/
@ExtendWith(GradleMultiDslExtension.class)
public class IntegratingWithActuatorDocumentationTests {
class IntegratingWithActuatorDocumentationTests {
GradleBuild gradleBuild;
@TestTemplate
public void basicBuildInfo() throws IOException {
void basicBuildInfo() throws IOException {
this.gradleBuild.script("src/main/gradle/integrating-with-actuator/build-info-basic").build("bootBuildInfo");
assertThat(new File(this.gradleBuild.getProjectDir(), "build/resources/main/META-INF/build-info.properties"))
.isFile();
}
@TestTemplate
public void buildInfoCustomValues() throws IOException {
void buildInfoCustomValues() throws IOException {
this.gradleBuild.script("src/main/gradle/integrating-with-actuator/build-info-custom-values")
.build("bootBuildInfo");
File file = new File(this.gradleBuild.getProjectDir(), "build/resources/main/META-INF/build-info.properties");
@ -61,7 +61,7 @@ public class IntegratingWithActuatorDocumentationTests {
}
@TestTemplate
public void buildInfoAdditional() throws IOException {
void buildInfoAdditional() throws IOException {
this.gradleBuild.script("src/main/gradle/integrating-with-actuator/build-info-additional")
.build("bootBuildInfo");
File file = new File(this.gradleBuild.getProjectDir(), "build/resources/main/META-INF/build-info.properties");

View File

@ -33,29 +33,29 @@ import static org.junit.jupiter.api.Assumptions.assumingThat;
* @author Jean-Baptiste Nizet
*/
@ExtendWith(GradleMultiDslExtension.class)
public class ManagingDependenciesDocumentationTests {
class ManagingDependenciesDocumentationTests {
GradleBuild gradleBuild;
@TestTemplate
public void dependenciesExampleEvaluatesSuccessfully() {
void dependenciesExampleEvaluatesSuccessfully() {
this.gradleBuild.script("src/main/gradle/managing-dependencies/dependencies").build();
}
@TestTemplate
public void customManagedVersions() {
void customManagedVersions() {
assertThat(this.gradleBuild.script("src/main/gradle/managing-dependencies/custom-version").build("slf4jVersion")
.getOutput()).contains("1.7.20");
}
@TestTemplate
public void dependencyManagementInIsolation() {
void dependencyManagementInIsolation() {
assertThat(this.gradleBuild.script("src/main/gradle/managing-dependencies/configure-bom")
.build("dependencyManagement").getOutput()).contains("org.springframework.boot:spring-boot-starter ");
}
@TestTemplate
public void dependencyManagementInIsolationWithPluginsBlock() {
void dependencyManagementInIsolationWithPluginsBlock() {
assumingThat(this.gradleBuild.getDsl() == Dsl.KOTLIN,
() -> assertThat(
this.gradleBuild.script("src/main/gradle/managing-dependencies/configure-bom-with-plugins")

View File

@ -43,17 +43,17 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Jean-Baptiste Nizet
*/
@ExtendWith(GradleMultiDslExtension.class)
public class PackagingDocumentationTests {
class PackagingDocumentationTests {
GradleBuild gradleBuild;
@TestTemplate
public void warContainerDependencyEvaluatesSuccessfully() {
void warContainerDependencyEvaluatesSuccessfully() {
this.gradleBuild.script("src/main/gradle/packaging/war-container-dependency").build();
}
@TestTemplate
public void bootJarMainClass() throws IOException {
void bootJarMainClass() throws IOException {
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-main-class").build("bootJar");
File file = new File(this.gradleBuild.getProjectDir(),
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
@ -65,7 +65,7 @@ public class PackagingDocumentationTests {
}
@TestTemplate
public void bootJarManifestMainClass() throws IOException {
void bootJarManifestMainClass() throws IOException {
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-manifest-main-class").build("bootJar");
File file = new File(this.gradleBuild.getProjectDir(),
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
@ -77,7 +77,7 @@ public class PackagingDocumentationTests {
}
@TestTemplate
public void applicationPluginMainClass() throws IOException {
void applicationPluginMainClass() throws IOException {
this.gradleBuild.script("src/main/gradle/packaging/application-plugin-main-class").build("bootJar");
File file = new File(this.gradleBuild.getProjectDir(),
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
@ -89,7 +89,7 @@ public class PackagingDocumentationTests {
}
@TestTemplate
public void springBootDslMainClass() throws IOException {
void springBootDslMainClass() throws IOException {
this.gradleBuild.script("src/main/gradle/packaging/spring-boot-dsl-main-class").build("bootJar");
File file = new File(this.gradleBuild.getProjectDir(),
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
@ -101,7 +101,7 @@ public class PackagingDocumentationTests {
}
@TestTemplate
public void bootWarIncludeDevtools() throws IOException {
void bootWarIncludeDevtools() throws IOException {
jarFile(new File(this.gradleBuild.getProjectDir(), "spring-boot-devtools-1.2.3.RELEASE.jar"));
this.gradleBuild.script("src/main/gradle/packaging/boot-war-include-devtools").build("bootWar");
File file = new File(this.gradleBuild.getProjectDir(),
@ -113,7 +113,7 @@ public class PackagingDocumentationTests {
}
@TestTemplate
public void bootJarRequiresUnpack() throws IOException {
void bootJarRequiresUnpack() throws IOException {
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-requires-unpack").build("bootJar");
File file = new File(this.gradleBuild.getProjectDir(),
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
@ -126,7 +126,7 @@ public class PackagingDocumentationTests {
}
@TestTemplate
public void bootJarIncludeLaunchScript() throws IOException {
void bootJarIncludeLaunchScript() throws IOException {
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-include-launch-script").build("bootJar");
File file = new File(this.gradleBuild.getProjectDir(),
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
@ -135,7 +135,7 @@ public class PackagingDocumentationTests {
}
@TestTemplate
public void bootJarLaunchScriptProperties() throws IOException {
void bootJarLaunchScriptProperties() throws IOException {
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-launch-script-properties").build("bootJar");
File file = new File(this.gradleBuild.getProjectDir(),
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
@ -144,7 +144,7 @@ public class PackagingDocumentationTests {
}
@TestTemplate
public void bootJarCustomLaunchScript() throws IOException {
void bootJarCustomLaunchScript() throws IOException {
File customScriptFile = new File(this.gradleBuild.getProjectDir(), "src/custom.script");
customScriptFile.getParentFile().mkdirs();
FileCopyUtils.copy("custom", new FileWriter(customScriptFile));
@ -156,7 +156,7 @@ public class PackagingDocumentationTests {
}
@TestTemplate
public void bootWarPropertiesLauncher() throws IOException {
void bootWarPropertiesLauncher() throws IOException {
this.gradleBuild.script("src/main/gradle/packaging/boot-war-properties-launcher").build("bootWar");
File file = new File(this.gradleBuild.getProjectDir(),
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".war");
@ -168,7 +168,7 @@ public class PackagingDocumentationTests {
}
@TestTemplate
public void bootJarAndJar() {
void bootJarAndJar() {
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-and-jar").build("assemble");
File jar = new File(this.gradleBuild.getProjectDir(),
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");

View File

@ -33,18 +33,18 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Jean-Baptiste Nizet
*/
@ExtendWith(GradleMultiDslExtension.class)
public class PublishingDocumentationTests {
class PublishingDocumentationTests {
GradleBuild gradleBuild;
@TestTemplate
public void mavenUpload() throws IOException {
void mavenUpload() throws IOException {
assertThat(this.gradleBuild.script("src/main/gradle/publishing/maven").build("deployerRepository").getOutput())
.contains("https://repo.example.com");
}
@TestTemplate
public void mavenPublish() throws IOException {
void mavenPublish() throws IOException {
assertThat(this.gradleBuild.script("src/main/gradle/publishing/maven-publish").build("publishingConfiguration")
.getOutput()).contains("MavenPublication").contains("https://repo.example.com");
}

View File

@ -34,36 +34,36 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Jean-Baptiste Nizet
*/
@ExtendWith(GradleMultiDslExtension.class)
public class RunningDocumentationTests {
class RunningDocumentationTests {
GradleBuild gradleBuild;
@TestTemplate
public void bootRunMain() throws IOException {
void bootRunMain() throws IOException {
assertThat(this.gradleBuild.script("src/main/gradle/running/boot-run-main").build("configuredMainClass")
.getOutput()).contains("com.example.ExampleApplication");
}
@TestTemplate
public void applicationPluginMainClassName() {
void applicationPluginMainClassName() {
assertThat(this.gradleBuild.script("src/main/gradle/running/application-plugin-main-class-name")
.build("configuredMainClass").getOutput()).contains("com.example.ExampleApplication");
}
@TestTemplate
public void springBootDslMainClassName() throws IOException {
void springBootDslMainClassName() throws IOException {
assertThat(this.gradleBuild.script("src/main/gradle/running/spring-boot-dsl-main-class-name")
.build("configuredMainClass").getOutput()).contains("com.example.ExampleApplication");
}
@TestTemplate
public void bootRunSourceResources() throws IOException {
void bootRunSourceResources() throws IOException {
assertThat(this.gradleBuild.script("src/main/gradle/running/boot-run-source-resources")
.build("configuredClasspath").getOutput()).contains(new File("src/main/resources").getPath());
}
@TestTemplate
public void bootRunDisableOptimizedLaunch() throws IOException {
void bootRunDisableOptimizedLaunch() throws IOException {
assertThat(this.gradleBuild.script("src/main/gradle/running/boot-run-disable-optimized-launch")
.build("optimizedLaunch").getOutput()).contains("false");
}

View File

@ -43,42 +43,42 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
*/
@ExtendWith(GradleCompatibilityExtension.class)
public class ApplicationPluginActionIntegrationTests {
class ApplicationPluginActionIntegrationTests {
GradleBuild gradleBuild;
@TestTemplate
public void noBootDistributionWithoutApplicationPluginApplied() {
void noBootDistributionWithoutApplicationPluginApplied() {
assertThat(this.gradleBuild.build("distributionExists", "-PdistributionName=boot").getOutput())
.contains("boot exists = false");
}
@TestTemplate
public void applyingApplicationPluginCreatesBootDistribution() {
void applyingApplicationPluginCreatesBootDistribution() {
assertThat(this.gradleBuild.build("distributionExists", "-PdistributionName=boot", "-PapplyApplicationPlugin")
.getOutput()).contains("boot exists = true");
}
@TestTemplate
public void noBootStartScriptsTaskWithoutApplicationPluginApplied() {
void noBootStartScriptsTaskWithoutApplicationPluginApplied() {
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootStartScripts").getOutput())
.contains("bootStartScripts exists = false");
}
@TestTemplate
public void applyingApplicationPluginCreatesBootStartScriptsTask() {
void applyingApplicationPluginCreatesBootStartScriptsTask() {
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootStartScripts", "-PapplyApplicationPlugin")
.getOutput()).contains("bootStartScripts exists = true");
}
@TestTemplate
public void createsBootStartScriptsTaskUsesApplicationPluginsDefaultJvmOpts() {
void createsBootStartScriptsTaskUsesApplicationPluginsDefaultJvmOpts() {
assertThat(this.gradleBuild.build("startScriptsDefaultJvmOpts", "-PapplyApplicationPlugin").getOutput())
.contains("bootStartScripts defaultJvmOpts = [-Dcom.example.a=alpha, -Dcom.example.b=bravo]");
}
@TestTemplate
public void zipDistributionForJarCanBeBuilt() throws IOException {
void zipDistributionForJarCanBeBuilt() throws IOException {
assertThat(this.gradleBuild.build("bootDistZip").task(":bootDistZip").getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
String name = this.gradleBuild.getProjectDir().getName();
@ -90,7 +90,7 @@ public class ApplicationPluginActionIntegrationTests {
}
@TestTemplate
public void tarDistributionForJarCanBeBuilt() throws IOException {
void tarDistributionForJarCanBeBuilt() throws IOException {
assertThat(this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
String name = this.gradleBuild.getProjectDir().getName();
@ -102,7 +102,7 @@ public class ApplicationPluginActionIntegrationTests {
}
@TestTemplate
public void zipDistributionForWarCanBeBuilt() throws IOException {
void zipDistributionForWarCanBeBuilt() throws IOException {
assertThat(this.gradleBuild.build("bootDistZip").task(":bootDistZip").getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
String name = this.gradleBuild.getProjectDir().getName();
@ -114,7 +114,7 @@ public class ApplicationPluginActionIntegrationTests {
}
@TestTemplate
public void tarDistributionForWarCanBeBuilt() throws IOException {
void tarDistributionForWarCanBeBuilt() throws IOException {
assertThat(this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
String name = this.gradleBuild.getProjectDir().getName();
@ -126,7 +126,7 @@ public class ApplicationPluginActionIntegrationTests {
}
@TestTemplate
public void applicationNameCanBeUsedToCustomizeDistributionName() throws IOException {
void applicationNameCanBeUsedToCustomizeDistributionName() throws IOException {
assertThat(this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
File distribution = new File(this.gradleBuild.getProjectDir(), "build/distributions/custom-boot.tar");
@ -138,7 +138,7 @@ public class ApplicationPluginActionIntegrationTests {
}
@TestTemplate
public void scriptsHaveCorrectPermissions() throws IOException {
void scriptsHaveCorrectPermissions() throws IOException {
assertThat(this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
String name = this.gradleBuild.getProjectDir().getName();

View File

@ -37,24 +37,24 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
*/
@ExtendWith(GradleCompatibilityExtension.class)
public class DependencyManagementPluginActionIntegrationTests {
class DependencyManagementPluginActionIntegrationTests {
GradleBuild gradleBuild;
@TestTemplate
public void noDependencyManagementIsAppliedByDefault() {
void noDependencyManagementIsAppliedByDefault() {
assertThat(this.gradleBuild.build("doesNotHaveDependencyManagement").task(":doesNotHaveDependencyManagement")
.getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
}
@TestTemplate
public void bomIsImportedWhenDependencyManagementPluginIsApplied() {
void bomIsImportedWhenDependencyManagementPluginIsApplied() {
assertThat(this.gradleBuild.build("hasDependencyManagement", "-PapplyDependencyManagementPlugin")
.task(":hasDependencyManagement").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
}
@TestTemplate
public void helpfulErrorWhenVersionlessDependencyFailsToResolve() throws IOException {
void helpfulErrorWhenVersionlessDependencyFailsToResolve() throws IOException {
File examplePackage = new File(this.gradleBuild.getProjectDir(), "src/main/java/com/example");
examplePackage.mkdirs();
FileSystemUtils.copyRecursively(new File("src/test/java/com/example"), examplePackage);

View File

@ -37,77 +37,77 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
*/
@ExtendWith(GradleCompatibilityExtension.class)
public class JavaPluginActionIntegrationTests {
class JavaPluginActionIntegrationTests {
GradleBuild gradleBuild;
@TestTemplate
public void noBootJarTaskWithoutJavaPluginApplied() {
void noBootJarTaskWithoutJavaPluginApplied() {
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootJar").getOutput())
.contains("bootJar exists = false");
}
@TestTemplate
public void applyingJavaPluginCreatesBootJarTask() {
void applyingJavaPluginCreatesBootJarTask() {
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootJar", "-PapplyJavaPlugin").getOutput())
.contains("bootJar exists = true");
}
@TestTemplate
public void noBootRunTaskWithoutJavaPluginApplied() {
void noBootRunTaskWithoutJavaPluginApplied() {
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootRun").getOutput())
.contains("bootRun exists = false");
}
@TestTemplate
public void applyingJavaPluginCreatesBootRunTask() {
void applyingJavaPluginCreatesBootRunTask() {
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootRun", "-PapplyJavaPlugin").getOutput())
.contains("bootRun exists = true");
}
@TestTemplate
public void javaCompileTasksUseUtf8Encoding() {
void javaCompileTasksUseUtf8Encoding() {
assertThat(this.gradleBuild.build("javaCompileEncoding", "-PapplyJavaPlugin").getOutput())
.contains("compileJava = UTF-8").contains("compileTestJava = UTF-8");
}
@TestTemplate
public void javaCompileTasksUseParametersCompilerFlagByDefault() {
void javaCompileTasksUseParametersCompilerFlagByDefault() {
assertThat(this.gradleBuild.build("javaCompileTasksCompilerArgs").getOutput())
.contains("compileJava compiler args: [-parameters]")
.contains("compileTestJava compiler args: [-parameters]");
}
@TestTemplate
public void javaCompileTasksUseParametersAndAdditionalCompilerFlags() {
void javaCompileTasksUseParametersAndAdditionalCompilerFlags() {
assertThat(this.gradleBuild.build("javaCompileTasksCompilerArgs").getOutput())
.contains("compileJava compiler args: [-parameters, -Xlint:all]")
.contains("compileTestJava compiler args: [-parameters, -Xlint:all]");
}
@TestTemplate
public void javaCompileTasksCanOverrideDefaultParametersCompilerFlag() {
void javaCompileTasksCanOverrideDefaultParametersCompilerFlag() {
assertThat(this.gradleBuild.build("javaCompileTasksCompilerArgs").getOutput())
.contains("compileJava compiler args: [-Xlint:all]")
.contains("compileTestJava compiler args: [-Xlint:all]");
}
@TestTemplate
public void assembleRunsBootJarAndJarIsSkipped() {
void assembleRunsBootJarAndJarIsSkipped() {
BuildResult result = this.gradleBuild.build("assemble");
assertThat(result.task(":bootJar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.task(":jar").getOutcome()).isEqualTo(TaskOutcome.SKIPPED);
}
@TestTemplate
public void errorMessageIsHelpfulWhenMainClassCannotBeResolved() {
void errorMessageIsHelpfulWhenMainClassCannotBeResolved() {
BuildResult result = this.gradleBuild.buildAndFail("build", "-PapplyJavaPlugin");
assertThat(result.task(":bootJar").getOutcome()).isEqualTo(TaskOutcome.FAILED);
assertThat(result.getOutput()).contains("Main class name has not been configured and it could not be resolved");
}
@TestTemplate
public void jarAndBootJarCanBothBeBuilt() {
void jarAndBootJarCanBothBeBuilt() {
BuildResult result = this.gradleBuild.build("assemble");
assertThat(result.task(":bootJar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.task(":jar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
@ -118,7 +118,7 @@ public class JavaPluginActionIntegrationTests {
}
@TestTemplate
public void additionalMetadataLocationsConfiguredWhenProcessorIsPresent() throws IOException {
void additionalMetadataLocationsConfiguredWhenProcessorIsPresent() throws IOException {
createMinimalMainSource();
File libs = new File(this.gradleBuild.getProjectDir(), "libs");
libs.mkdirs();
@ -132,7 +132,7 @@ public class JavaPluginActionIntegrationTests {
}
@TestTemplate
public void additionalMetadataLocationsNotConfiguredWhenProcessorIsAbsent() throws IOException {
void additionalMetadataLocationsNotConfiguredWhenProcessorIsAbsent() throws IOException {
createMinimalMainSource();
BuildResult result = this.gradleBuild.build("compileJava");
assertThat(result.task(":compileJava").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);

View File

@ -30,30 +30,30 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
*/
@ExtendWith(GradleCompatibilityExtension.class)
public class KotlinPluginActionIntegrationTests {
class KotlinPluginActionIntegrationTests {
GradleBuild gradleBuild;
@TestTemplate
public void noKotlinVersionPropertyWithoutKotlinPlugin() {
void noKotlinVersionPropertyWithoutKotlinPlugin() {
assertThat(this.gradleBuild.build("kotlinVersion").getOutput()).contains("Kotlin version: none");
}
@TestTemplate
public void kotlinVersionPropertyIsSet() {
void kotlinVersionPropertyIsSet() {
String output = this.gradleBuild.build("kotlinVersion", "dependencies", "--configuration", "compileClasspath")
.getOutput();
assertThat(output).containsPattern("Kotlin version: [0-9]\\.[0-9]\\.[0-9]+");
}
@TestTemplate
public void kotlinCompileTasksUseJavaParametersFlagByDefault() {
void kotlinCompileTasksUseJavaParametersFlagByDefault() {
assertThat(this.gradleBuild.build("kotlinCompileTasksJavaParameters").getOutput())
.contains("compileKotlin java parameters: true").contains("compileTestKotlin java parameters: true");
}
@TestTemplate
public void kotlinCompileTasksCanOverrideDefaultJavaParametersFlag() {
void kotlinCompileTasksCanOverrideDefaultJavaParametersFlag() {
assertThat(this.gradleBuild.build("kotlinCompileTasksJavaParameters").getOutput())
.contains("compileKotlin java parameters: false").contains("compileTestKotlin java parameters: false");
}

View File

@ -30,12 +30,12 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
*/
@ExtendWith(GradleCompatibilityExtension.class)
public class MavenPluginActionIntegrationTests {
class MavenPluginActionIntegrationTests {
GradleBuild gradleBuild;
@TestTemplate
public void clearsConf2ScopeMappingsOfUploadBootArchivesTask() {
void clearsConf2ScopeMappingsOfUploadBootArchivesTask() {
assertThat(this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("6.0.0").build("conf2ScopeMappings")
.getOutput()).contains("Conf2ScopeMappings = 0");
}

View File

@ -31,12 +31,12 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
*/
@ExtendWith(GradleCompatibilityExtension.class)
public class OnlyDependencyManagementIntegrationTests {
class OnlyDependencyManagementIntegrationTests {
GradleBuild gradleBuild;
@TestTemplate
public void dependencyManagementCanBeConfiguredUsingCoordinatesConstant() {
void dependencyManagementCanBeConfiguredUsingCoordinatesConstant() {
assertThat(this.gradleBuild.build("dependencyManagement").getOutput())
.contains("org.springframework.boot:spring-boot-starter ");
}

View File

@ -34,31 +34,31 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
*/
@ExtendWith(GradleCompatibilityExtension.class)
public class WarPluginActionIntegrationTests {
class WarPluginActionIntegrationTests {
GradleBuild gradleBuild;
@TestTemplate
public void noBootWarTaskWithoutWarPluginApplied() {
void noBootWarTaskWithoutWarPluginApplied() {
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootWar").getOutput())
.contains("bootWar exists = false");
}
@TestTemplate
public void applyingWarPluginCreatesBootWarTask() {
void applyingWarPluginCreatesBootWarTask() {
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootWar", "-PapplyWarPlugin").getOutput())
.contains("bootWar exists = true");
}
@TestTemplate
public void assembleRunsBootWarAndWarIsSkipped() {
void assembleRunsBootWarAndWarIsSkipped() {
BuildResult result = this.gradleBuild.build("assemble");
assertThat(result.task(":bootWar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.task(":war").getOutcome()).isEqualTo(TaskOutcome.SKIPPED);
}
@TestTemplate
public void warAndBootWarCanBothBeBuilt() {
void warAndBootWarCanBothBeBuilt() {
BuildResult result = this.gradleBuild.build("assemble");
assertThat(result.task(":bootWar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.task(":war").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
@ -69,7 +69,7 @@ public class WarPluginActionIntegrationTests {
}
@TestTemplate
public void errorMessageIsHelpfulWhenMainClassCannotBeResolved() {
void errorMessageIsHelpfulWhenMainClassCannotBeResolved() {
BuildResult result = this.gradleBuild.buildAndFail("build", "-PapplyWarPlugin");
assertThat(result.task(":bootWar").getOutcome()).isEqualTo(TaskOutcome.FAILED);
assertThat(result.getOutput()).contains("Main class name has not been configured and it could not be resolved");

View File

@ -40,12 +40,12 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
*/
@ExtendWith(GradleCompatibilityExtension.class)
public class BuildInfoIntegrationTests {
class BuildInfoIntegrationTests {
GradleBuild gradleBuild;
@TestTemplate
public void defaultValues() {
void defaultValues() {
assertThat(this.gradleBuild.build("buildInfo").task(":buildInfo").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
Properties buildInfoProperties = buildInfoProperties();
assertThat(buildInfoProperties).containsKey("build.time");
@ -56,7 +56,7 @@ public class BuildInfoIntegrationTests {
}
@TestTemplate
public void basicExecution() {
void basicExecution() {
assertThat(this.gradleBuild.build("buildInfo").task(":buildInfo").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
Properties buildInfoProperties = buildInfoProperties();
assertThat(buildInfoProperties).containsKey("build.time");
@ -68,13 +68,13 @@ public class BuildInfoIntegrationTests {
}
@TestTemplate
public void notUpToDateWhenExecutedTwiceAsTimeChanges() {
void notUpToDateWhenExecutedTwiceAsTimeChanges() {
assertThat(this.gradleBuild.build("buildInfo").task(":buildInfo").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(this.gradleBuild.build("buildInfo").task(":buildInfo").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
}
@TestTemplate
public void upToDateWhenExecutedTwiceWithFixedTime() {
void upToDateWhenExecutedTwiceWithFixedTime() {
assertThat(this.gradleBuild.build("buildInfo", "-PnullTime").task(":buildInfo").getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
assertThat(this.gradleBuild.build("buildInfo", "-PnullTime").task(":buildInfo").getOutcome())
@ -82,7 +82,7 @@ public class BuildInfoIntegrationTests {
}
@TestTemplate
public void notUpToDateWhenExecutedTwiceWithFixedTimeAndChangedProjectVersion() {
void notUpToDateWhenExecutedTwiceWithFixedTimeAndChangedProjectVersion() {
assertThat(this.gradleBuild.build("buildInfo", "-PnullTime").task(":buildInfo").getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
BuildResult result = this.gradleBuild.build("buildInfo", "-PnullTime", "-PprojectVersion=0.2.0");
@ -90,7 +90,7 @@ public class BuildInfoIntegrationTests {
}
@TestTemplate
public void reproducibleOutputWithFixedTime()
void reproducibleOutputWithFixedTime()
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException, InterruptedException {
assertThat(this.gradleBuild.build("buildInfo", "-PnullTime").task(":buildInfo").getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);

View File

@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
*/
@ExtendWith(GradleCompatibilityExtension.class)
public abstract class AbstractBootArchiveIntegrationTests {
abstract class AbstractBootArchiveIntegrationTests {
GradleBuild gradleBuild;
@ -49,13 +49,13 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
@TestTemplate
public void basicBuild() throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException {
void basicBuild() throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException {
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
}
@TestTemplate
public void reproducibleArchive()
void reproducibleArchive()
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException, InterruptedException {
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
@ -69,8 +69,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
@TestTemplate
public void upToDateWhenBuiltTwice()
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException {
void upToDateWhenBuiltTwice() throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException {
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
@ -78,7 +77,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
@TestTemplate
public void upToDateWhenBuiltTwiceWithLaunchScriptIncluded()
void upToDateWhenBuiltTwiceWithLaunchScriptIncluded()
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException {
assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", this.taskName).task(":" + this.taskName)
.getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
@ -87,7 +86,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
@TestTemplate
public void notUpToDateWhenLaunchScriptWasNotIncludedAndThenIsIncluded() {
void notUpToDateWhenLaunchScriptWasNotIncludedAndThenIsIncluded() {
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", this.taskName).task(":" + this.taskName)
@ -95,7 +94,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
@TestTemplate
public void notUpToDateWhenLaunchScriptWasIncludedAndThenIsNotIncluded() {
void notUpToDateWhenLaunchScriptWasIncludedAndThenIsNotIncluded() {
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", this.taskName).task(":" + this.taskName)
@ -103,7 +102,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
@TestTemplate
public void notUpToDateWhenLaunchScriptPropertyChanges() {
void notUpToDateWhenLaunchScriptPropertyChanges() {
assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", "-PlaunchScriptProperty=foo", this.taskName)
.task(":" + this.taskName).getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", "-PlaunchScriptProperty=bar", this.taskName)
@ -111,7 +110,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
@TestTemplate
public void applicationPluginMainClassNameIsUsed() throws IOException {
void applicationPluginMainClassNameIsUsed() throws IOException {
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
try (JarFile jarFile = new JarFile(new File(this.gradleBuild.getProjectDir(), "build/libs").listFiles()[0])) {
@ -121,7 +120,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
@TestTemplate
public void springBootExtensionMainClassNameIsUsed() throws IOException {
void springBootExtensionMainClassNameIsUsed() throws IOException {
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
try (JarFile jarFile = new JarFile(new File(this.gradleBuild.getProjectDir(), "build/libs").listFiles()[0])) {
@ -131,7 +130,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
@TestTemplate
public void duplicatesAreHandledGracefully() throws IOException {
void duplicatesAreHandledGracefully() throws IOException {
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
}

View File

@ -21,9 +21,9 @@ package org.springframework.boot.gradle.tasks.bundling;
*
* @author Andy Wilkinson
*/
public class BootJarIntegrationTests extends AbstractBootArchiveIntegrationTests {
class BootJarIntegrationTests extends AbstractBootArchiveIntegrationTests {
public BootJarIntegrationTests() {
BootJarIntegrationTests() {
super("bootJar");
}

View File

@ -21,9 +21,9 @@ package org.springframework.boot.gradle.tasks.bundling;
*
* @author Andy Wilkinson
*/
public class BootWarIntegrationTests extends AbstractBootArchiveIntegrationTests {
class BootWarIntegrationTests extends AbstractBootArchiveIntegrationTests {
public BootWarIntegrationTests() {
BootWarIntegrationTests() {
super("bootWar");
}

View File

@ -36,12 +36,12 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
*/
@ExtendWith(GradleCompatibilityExtension.class)
public class MavenIntegrationTests {
class MavenIntegrationTests {
GradleBuild gradleBuild;
@TestTemplate
public void bootJarCanBeUploaded() throws FileNotFoundException, IOException {
void bootJarCanBeUploaded() throws FileNotFoundException, IOException {
BuildResult result = this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("6.0.0")
.build("uploadBootArchives");
assertThat(result.task(":uploadBootArchives").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
@ -51,7 +51,7 @@ public class MavenIntegrationTests {
}
@TestTemplate
public void bootWarCanBeUploaded() throws IOException {
void bootWarCanBeUploaded() throws IOException {
BuildResult result = this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("6.0.0")
.build("uploadBootArchives");
assertThat(result.task(":uploadBootArchives").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);

View File

@ -37,12 +37,12 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
*/
@ExtendWith(GradleCompatibilityExtension.class)
public class MavenPublishingIntegrationTests {
class MavenPublishingIntegrationTests {
GradleBuild gradleBuild;
@TestTemplate
public void bootJarCanBePublished() throws FileNotFoundException, IOException {
void bootJarCanBePublished() throws FileNotFoundException, IOException {
BuildResult result = this.gradleBuild.build("publish");
assertThat(result.task(":publish").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(artifactWithSuffix("jar")).isFile();
@ -51,7 +51,7 @@ public class MavenPublishingIntegrationTests {
}
@TestTemplate
public void bootWarCanBePublished() throws IOException {
void bootWarCanBePublished() throws IOException {
BuildResult result = this.gradleBuild.build("publish");
assertThat(result.task(":publish").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(artifactWithSuffix("war")).isFile();

View File

@ -36,12 +36,12 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
*/
@ExtendWith(GradleCompatibilityExtension.class)
public class BootRunIntegrationTests {
class BootRunIntegrationTests {
GradleBuild gradleBuild;
@TestTemplate
public void basicExecution() throws IOException {
void basicExecution() throws IOException {
copyClasspathApplication();
new File(this.gradleBuild.getProjectDir(), "src/main/resources").mkdirs();
BuildResult result = this.gradleBuild.build("bootRun");
@ -52,7 +52,7 @@ public class BootRunIntegrationTests {
}
@TestTemplate
public void sourceResourcesCanBeUsed() throws IOException {
void sourceResourcesCanBeUsed() throws IOException {
copyClasspathApplication();
BuildResult result = this.gradleBuild.build("bootRun");
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
@ -62,21 +62,21 @@ public class BootRunIntegrationTests {
}
@TestTemplate
public void springBootExtensionMainClassNameIsUsed() throws IOException {
void springBootExtensionMainClassNameIsUsed() throws IOException {
BuildResult result = this.gradleBuild.build("echoMainClassName");
assertThat(result.task(":echoMainClassName").getOutcome()).isEqualTo(TaskOutcome.UP_TO_DATE);
assertThat(result.getOutput()).contains("Main class name = com.example.CustomMainClass");
}
@TestTemplate
public void applicationPluginMainClassNameIsUsed() throws IOException {
void applicationPluginMainClassNameIsUsed() throws IOException {
BuildResult result = this.gradleBuild.build("echoMainClassName");
assertThat(result.task(":echoMainClassName").getOutcome()).isEqualTo(TaskOutcome.UP_TO_DATE);
assertThat(result.getOutput()).contains("Main class name = com.example.CustomMainClass");
}
@TestTemplate
public void applicationPluginMainClassNameIsNotUsedWhenItIsNull() throws IOException {
void applicationPluginMainClassNameIsNotUsedWhenItIsNull() throws IOException {
copyClasspathApplication();
BuildResult result = this.gradleBuild.build("echoMainClassName");
assertThat(result.task(":echoMainClassName").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
@ -84,7 +84,7 @@ public class BootRunIntegrationTests {
}
@TestTemplate
public void defaultJvmArgs() throws IOException {
void defaultJvmArgs() throws IOException {
copyJvmArgsApplication();
BuildResult result = this.gradleBuild.build("bootRun");
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
@ -92,7 +92,7 @@ public class BootRunIntegrationTests {
}
@TestTemplate
public void optimizedLaunchDisabledJvmArgs() throws IOException {
void optimizedLaunchDisabledJvmArgs() throws IOException {
copyJvmArgsApplication();
BuildResult result = this.gradleBuild.build("bootRun");
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
@ -100,7 +100,7 @@ public class BootRunIntegrationTests {
}
@TestTemplate
public void applicationPluginJvmArgumentsAreUsed() throws IOException {
void applicationPluginJvmArgumentsAreUsed() throws IOException {
copyJvmArgsApplication();
BuildResult result = this.gradleBuild.build("bootRun");
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);