Skip to content

Commit 47b47c2

Browse files
committed
Reduce visibility of the Gradle plugin's test methods
See gh-19287
1 parent a2451a4 commit 47b47c2

20 files changed

+115
-116
lines changed

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/GettingStartedDocumentationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
* @author Jean-Baptiste Nizet
3030
*/
3131
@ExtendWith(GradleMultiDslExtension.class)
32-
public class GettingStartedDocumentationTests {
32+
class GettingStartedDocumentationTests {
3333

3434
GradleBuild gradleBuild;
3535

3636
// NOTE: We can't run any `apply-plugin` tests because during a release the
3737
// jar won't be there
3838

3939
@TestTemplate
40-
public void typicalPluginsAppliesExceptedPlugins() {
40+
void typicalPluginsAppliesExceptedPlugins() {
4141
this.gradleBuild.script("src/main/gradle/getting-started/typical-plugins").build("verify");
4242
}
4343

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/IntegratingWithActuatorDocumentationTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@
3636
* @author Jean-Baptiste Nizet
3737
*/
3838
@ExtendWith(GradleMultiDslExtension.class)
39-
public class IntegratingWithActuatorDocumentationTests {
39+
class IntegratingWithActuatorDocumentationTests {
4040

4141
GradleBuild gradleBuild;
4242

4343
@TestTemplate
44-
public void basicBuildInfo() throws IOException {
44+
void basicBuildInfo() throws IOException {
4545
this.gradleBuild.script("src/main/gradle/integrating-with-actuator/build-info-basic").build("bootBuildInfo");
4646
assertThat(new File(this.gradleBuild.getProjectDir(), "build/resources/main/META-INF/build-info.properties"))
4747
.isFile();
4848
}
4949

5050
@TestTemplate
51-
public void buildInfoCustomValues() throws IOException {
51+
void buildInfoCustomValues() throws IOException {
5252
this.gradleBuild.script("src/main/gradle/integrating-with-actuator/build-info-custom-values")
5353
.build("bootBuildInfo");
5454
File file = new File(this.gradleBuild.getProjectDir(), "build/resources/main/META-INF/build-info.properties");
@@ -61,7 +61,7 @@ public void buildInfoCustomValues() throws IOException {
6161
}
6262

6363
@TestTemplate
64-
public void buildInfoAdditional() throws IOException {
64+
void buildInfoAdditional() throws IOException {
6565
this.gradleBuild.script("src/main/gradle/integrating-with-actuator/build-info-additional")
6666
.build("bootBuildInfo");
6767
File file = new File(this.gradleBuild.getProjectDir(), "build/resources/main/META-INF/build-info.properties");

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/ManagingDependenciesDocumentationTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,29 @@
3333
* @author Jean-Baptiste Nizet
3434
*/
3535
@ExtendWith(GradleMultiDslExtension.class)
36-
public class ManagingDependenciesDocumentationTests {
36+
class ManagingDependenciesDocumentationTests {
3737

3838
GradleBuild gradleBuild;
3939

4040
@TestTemplate
41-
public void dependenciesExampleEvaluatesSuccessfully() {
41+
void dependenciesExampleEvaluatesSuccessfully() {
4242
this.gradleBuild.script("src/main/gradle/managing-dependencies/dependencies").build();
4343
}
4444

4545
@TestTemplate
46-
public void customManagedVersions() {
46+
void customManagedVersions() {
4747
assertThat(this.gradleBuild.script("src/main/gradle/managing-dependencies/custom-version").build("slf4jVersion")
4848
.getOutput()).contains("1.7.20");
4949
}
5050

5151
@TestTemplate
52-
public void dependencyManagementInIsolation() {
52+
void dependencyManagementInIsolation() {
5353
assertThat(this.gradleBuild.script("src/main/gradle/managing-dependencies/configure-bom")
5454
.build("dependencyManagement").getOutput()).contains("org.springframework.boot:spring-boot-starter ");
5555
}
5656

5757
@TestTemplate
58-
public void dependencyManagementInIsolationWithPluginsBlock() {
58+
void dependencyManagementInIsolationWithPluginsBlock() {
5959
assumingThat(this.gradleBuild.getDsl() == Dsl.KOTLIN,
6060
() -> assertThat(
6161
this.gradleBuild.script("src/main/gradle/managing-dependencies/configure-bom-with-plugins")

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/PackagingDocumentationTests.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@
4343
* @author Jean-Baptiste Nizet
4444
*/
4545
@ExtendWith(GradleMultiDslExtension.class)
46-
public class PackagingDocumentationTests {
46+
class PackagingDocumentationTests {
4747

4848
GradleBuild gradleBuild;
4949

5050
@TestTemplate
51-
public void warContainerDependencyEvaluatesSuccessfully() {
51+
void warContainerDependencyEvaluatesSuccessfully() {
5252
this.gradleBuild.script("src/main/gradle/packaging/war-container-dependency").build();
5353
}
5454

5555
@TestTemplate
56-
public void bootJarMainClass() throws IOException {
56+
void bootJarMainClass() throws IOException {
5757
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-main-class").build("bootJar");
5858
File file = new File(this.gradleBuild.getProjectDir(),
5959
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
@@ -65,7 +65,7 @@ public void bootJarMainClass() throws IOException {
6565
}
6666

6767
@TestTemplate
68-
public void bootJarManifestMainClass() throws IOException {
68+
void bootJarManifestMainClass() throws IOException {
6969
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-manifest-main-class").build("bootJar");
7070
File file = new File(this.gradleBuild.getProjectDir(),
7171
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
@@ -77,7 +77,7 @@ public void bootJarManifestMainClass() throws IOException {
7777
}
7878

7979
@TestTemplate
80-
public void applicationPluginMainClass() throws IOException {
80+
void applicationPluginMainClass() throws IOException {
8181
this.gradleBuild.script("src/main/gradle/packaging/application-plugin-main-class").build("bootJar");
8282
File file = new File(this.gradleBuild.getProjectDir(),
8383
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
@@ -89,7 +89,7 @@ public void applicationPluginMainClass() throws IOException {
8989
}
9090

9191
@TestTemplate
92-
public void springBootDslMainClass() throws IOException {
92+
void springBootDslMainClass() throws IOException {
9393
this.gradleBuild.script("src/main/gradle/packaging/spring-boot-dsl-main-class").build("bootJar");
9494
File file = new File(this.gradleBuild.getProjectDir(),
9595
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
@@ -101,7 +101,7 @@ public void springBootDslMainClass() throws IOException {
101101
}
102102

103103
@TestTemplate
104-
public void bootWarIncludeDevtools() throws IOException {
104+
void bootWarIncludeDevtools() throws IOException {
105105
jarFile(new File(this.gradleBuild.getProjectDir(), "spring-boot-devtools-1.2.3.RELEASE.jar"));
106106
this.gradleBuild.script("src/main/gradle/packaging/boot-war-include-devtools").build("bootWar");
107107
File file = new File(this.gradleBuild.getProjectDir(),
@@ -113,7 +113,7 @@ public void bootWarIncludeDevtools() throws IOException {
113113
}
114114

115115
@TestTemplate
116-
public void bootJarRequiresUnpack() throws IOException {
116+
void bootJarRequiresUnpack() throws IOException {
117117
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-requires-unpack").build("bootJar");
118118
File file = new File(this.gradleBuild.getProjectDir(),
119119
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
@@ -126,7 +126,7 @@ public void bootJarRequiresUnpack() throws IOException {
126126
}
127127

128128
@TestTemplate
129-
public void bootJarIncludeLaunchScript() throws IOException {
129+
void bootJarIncludeLaunchScript() throws IOException {
130130
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-include-launch-script").build("bootJar");
131131
File file = new File(this.gradleBuild.getProjectDir(),
132132
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
@@ -135,7 +135,7 @@ public void bootJarIncludeLaunchScript() throws IOException {
135135
}
136136

137137
@TestTemplate
138-
public void bootJarLaunchScriptProperties() throws IOException {
138+
void bootJarLaunchScriptProperties() throws IOException {
139139
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-launch-script-properties").build("bootJar");
140140
File file = new File(this.gradleBuild.getProjectDir(),
141141
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
@@ -144,7 +144,7 @@ public void bootJarLaunchScriptProperties() throws IOException {
144144
}
145145

146146
@TestTemplate
147-
public void bootJarCustomLaunchScript() throws IOException {
147+
void bootJarCustomLaunchScript() throws IOException {
148148
File customScriptFile = new File(this.gradleBuild.getProjectDir(), "src/custom.script");
149149
customScriptFile.getParentFile().mkdirs();
150150
FileCopyUtils.copy("custom", new FileWriter(customScriptFile));
@@ -156,7 +156,7 @@ public void bootJarCustomLaunchScript() throws IOException {
156156
}
157157

158158
@TestTemplate
159-
public void bootWarPropertiesLauncher() throws IOException {
159+
void bootWarPropertiesLauncher() throws IOException {
160160
this.gradleBuild.script("src/main/gradle/packaging/boot-war-properties-launcher").build("bootWar");
161161
File file = new File(this.gradleBuild.getProjectDir(),
162162
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".war");
@@ -168,7 +168,7 @@ public void bootWarPropertiesLauncher() throws IOException {
168168
}
169169

170170
@TestTemplate
171-
public void bootJarAndJar() {
171+
void bootJarAndJar() {
172172
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-and-jar").build("assemble");
173173
File jar = new File(this.gradleBuild.getProjectDir(),
174174
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/PublishingDocumentationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@
3333
* @author Jean-Baptiste Nizet
3434
*/
3535
@ExtendWith(GradleMultiDslExtension.class)
36-
public class PublishingDocumentationTests {
36+
class PublishingDocumentationTests {
3737

3838
GradleBuild gradleBuild;
3939

4040
@TestTemplate
41-
public void mavenUpload() throws IOException {
41+
void mavenUpload() throws IOException {
4242
assertThat(this.gradleBuild.script("src/main/gradle/publishing/maven").build("deployerRepository").getOutput())
4343
.contains("https://repo.example.com");
4444
}
4545

4646
@TestTemplate
47-
public void mavenPublish() throws IOException {
47+
void mavenPublish() throws IOException {
4848
assertThat(this.gradleBuild.script("src/main/gradle/publishing/maven-publish").build("publishingConfiguration")
4949
.getOutput()).contains("MavenPublication").contains("https://repo.example.com");
5050
}

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/RunningDocumentationTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,36 +34,36 @@
3434
* @author Jean-Baptiste Nizet
3535
*/
3636
@ExtendWith(GradleMultiDslExtension.class)
37-
public class RunningDocumentationTests {
37+
class RunningDocumentationTests {
3838

3939
GradleBuild gradleBuild;
4040

4141
@TestTemplate
42-
public void bootRunMain() throws IOException {
42+
void bootRunMain() throws IOException {
4343
assertThat(this.gradleBuild.script("src/main/gradle/running/boot-run-main").build("configuredMainClass")
4444
.getOutput()).contains("com.example.ExampleApplication");
4545
}
4646

4747
@TestTemplate
48-
public void applicationPluginMainClassName() {
48+
void applicationPluginMainClassName() {
4949
assertThat(this.gradleBuild.script("src/main/gradle/running/application-plugin-main-class-name")
5050
.build("configuredMainClass").getOutput()).contains("com.example.ExampleApplication");
5151
}
5252

5353
@TestTemplate
54-
public void springBootDslMainClassName() throws IOException {
54+
void springBootDslMainClassName() throws IOException {
5555
assertThat(this.gradleBuild.script("src/main/gradle/running/spring-boot-dsl-main-class-name")
5656
.build("configuredMainClass").getOutput()).contains("com.example.ExampleApplication");
5757
}
5858

5959
@TestTemplate
60-
public void bootRunSourceResources() throws IOException {
60+
void bootRunSourceResources() throws IOException {
6161
assertThat(this.gradleBuild.script("src/main/gradle/running/boot-run-source-resources")
6262
.build("configuredClasspath").getOutput()).contains(new File("src/main/resources").getPath());
6363
}
6464

6565
@TestTemplate
66-
public void bootRunDisableOptimizedLaunch() throws IOException {
66+
void bootRunDisableOptimizedLaunch() throws IOException {
6767
assertThat(this.gradleBuild.script("src/main/gradle/running/boot-run-disable-optimized-launch")
6868
.build("optimizedLaunch").getOutput()).contains("false");
6969
}

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/ApplicationPluginActionIntegrationTests.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,42 +43,42 @@
4343
* @author Andy Wilkinson
4444
*/
4545
@ExtendWith(GradleCompatibilityExtension.class)
46-
public class ApplicationPluginActionIntegrationTests {
46+
class ApplicationPluginActionIntegrationTests {
4747

4848
GradleBuild gradleBuild;
4949

5050
@TestTemplate
51-
public void noBootDistributionWithoutApplicationPluginApplied() {
51+
void noBootDistributionWithoutApplicationPluginApplied() {
5252
assertThat(this.gradleBuild.build("distributionExists", "-PdistributionName=boot").getOutput())
5353
.contains("boot exists = false");
5454
}
5555

5656
@TestTemplate
57-
public void applyingApplicationPluginCreatesBootDistribution() {
57+
void applyingApplicationPluginCreatesBootDistribution() {
5858
assertThat(this.gradleBuild.build("distributionExists", "-PdistributionName=boot", "-PapplyApplicationPlugin")
5959
.getOutput()).contains("boot exists = true");
6060
}
6161

6262
@TestTemplate
63-
public void noBootStartScriptsTaskWithoutApplicationPluginApplied() {
63+
void noBootStartScriptsTaskWithoutApplicationPluginApplied() {
6464
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootStartScripts").getOutput())
6565
.contains("bootStartScripts exists = false");
6666
}
6767

6868
@TestTemplate
69-
public void applyingApplicationPluginCreatesBootStartScriptsTask() {
69+
void applyingApplicationPluginCreatesBootStartScriptsTask() {
7070
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootStartScripts", "-PapplyApplicationPlugin")
7171
.getOutput()).contains("bootStartScripts exists = true");
7272
}
7373

7474
@TestTemplate
75-
public void createsBootStartScriptsTaskUsesApplicationPluginsDefaultJvmOpts() {
75+
void createsBootStartScriptsTaskUsesApplicationPluginsDefaultJvmOpts() {
7676
assertThat(this.gradleBuild.build("startScriptsDefaultJvmOpts", "-PapplyApplicationPlugin").getOutput())
7777
.contains("bootStartScripts defaultJvmOpts = [-Dcom.example.a=alpha, -Dcom.example.b=bravo]");
7878
}
7979

8080
@TestTemplate
81-
public void zipDistributionForJarCanBeBuilt() throws IOException {
81+
void zipDistributionForJarCanBeBuilt() throws IOException {
8282
assertThat(this.gradleBuild.build("bootDistZip").task(":bootDistZip").getOutcome())
8383
.isEqualTo(TaskOutcome.SUCCESS);
8484
String name = this.gradleBuild.getProjectDir().getName();
@@ -90,7 +90,7 @@ public void zipDistributionForJarCanBeBuilt() throws IOException {
9090
}
9191

9292
@TestTemplate
93-
public void tarDistributionForJarCanBeBuilt() throws IOException {
93+
void tarDistributionForJarCanBeBuilt() throws IOException {
9494
assertThat(this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
9595
.isEqualTo(TaskOutcome.SUCCESS);
9696
String name = this.gradleBuild.getProjectDir().getName();
@@ -102,7 +102,7 @@ public void tarDistributionForJarCanBeBuilt() throws IOException {
102102
}
103103

104104
@TestTemplate
105-
public void zipDistributionForWarCanBeBuilt() throws IOException {
105+
void zipDistributionForWarCanBeBuilt() throws IOException {
106106
assertThat(this.gradleBuild.build("bootDistZip").task(":bootDistZip").getOutcome())
107107
.isEqualTo(TaskOutcome.SUCCESS);
108108
String name = this.gradleBuild.getProjectDir().getName();
@@ -114,7 +114,7 @@ public void zipDistributionForWarCanBeBuilt() throws IOException {
114114
}
115115

116116
@TestTemplate
117-
public void tarDistributionForWarCanBeBuilt() throws IOException {
117+
void tarDistributionForWarCanBeBuilt() throws IOException {
118118
assertThat(this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
119119
.isEqualTo(TaskOutcome.SUCCESS);
120120
String name = this.gradleBuild.getProjectDir().getName();
@@ -126,7 +126,7 @@ public void tarDistributionForWarCanBeBuilt() throws IOException {
126126
}
127127

128128
@TestTemplate
129-
public void applicationNameCanBeUsedToCustomizeDistributionName() throws IOException {
129+
void applicationNameCanBeUsedToCustomizeDistributionName() throws IOException {
130130
assertThat(this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
131131
.isEqualTo(TaskOutcome.SUCCESS);
132132
File distribution = new File(this.gradleBuild.getProjectDir(), "build/distributions/custom-boot.tar");
@@ -138,7 +138,7 @@ public void applicationNameCanBeUsedToCustomizeDistributionName() throws IOExcep
138138
}
139139

140140
@TestTemplate
141-
public void scriptsHaveCorrectPermissions() throws IOException {
141+
void scriptsHaveCorrectPermissions() throws IOException {
142142
assertThat(this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
143143
.isEqualTo(TaskOutcome.SUCCESS);
144144
String name = this.gradleBuild.getProjectDir().getName();

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/DependencyManagementPluginActionIntegrationTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,24 @@
3737
* @author Andy Wilkinson
3838
*/
3939
@ExtendWith(GradleCompatibilityExtension.class)
40-
public class DependencyManagementPluginActionIntegrationTests {
40+
class DependencyManagementPluginActionIntegrationTests {
4141

4242
GradleBuild gradleBuild;
4343

4444
@TestTemplate
45-
public void noDependencyManagementIsAppliedByDefault() {
45+
void noDependencyManagementIsAppliedByDefault() {
4646
assertThat(this.gradleBuild.build("doesNotHaveDependencyManagement").task(":doesNotHaveDependencyManagement")
4747
.getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
4848
}
4949

5050
@TestTemplate
51-
public void bomIsImportedWhenDependencyManagementPluginIsApplied() {
51+
void bomIsImportedWhenDependencyManagementPluginIsApplied() {
5252
assertThat(this.gradleBuild.build("hasDependencyManagement", "-PapplyDependencyManagementPlugin")
5353
.task(":hasDependencyManagement").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
5454
}
5555

5656
@TestTemplate
57-
public void helpfulErrorWhenVersionlessDependencyFailsToResolve() throws IOException {
57+
void helpfulErrorWhenVersionlessDependencyFailsToResolve() throws IOException {
5858
File examplePackage = new File(this.gradleBuild.getProjectDir(), "src/main/java/com/example");
5959
examplePackage.mkdirs();
6060
FileSystemUtils.copyRecursively(new File("src/test/java/com/example"), examplePackage);

0 commit comments

Comments
 (0)