Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
47b47c28
Commit
47b47c28
authored
Dec 05, 2019
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce visibility of the Gradle plugin's test methods
See gh-19287
parent
a2451a4f
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
115 additions
and
116 deletions
+115
-116
GettingStartedDocumentationTests.java
...rk/boot/gradle/docs/GettingStartedDocumentationTests.java
+2
-2
IntegratingWithActuatorDocumentationTests.java
...radle/docs/IntegratingWithActuatorDocumentationTests.java
+4
-4
ManagingDependenciesDocumentationTests.java
...t/gradle/docs/ManagingDependenciesDocumentationTests.java
+5
-5
PackagingDocumentationTests.java
...amework/boot/gradle/docs/PackagingDocumentationTests.java
+13
-13
PublishingDocumentationTests.java
...mework/boot/gradle/docs/PublishingDocumentationTests.java
+3
-3
RunningDocumentationTests.java
...framework/boot/gradle/docs/RunningDocumentationTests.java
+6
-6
ApplicationPluginActionIntegrationTests.java
...radle/plugin/ApplicationPluginActionIntegrationTests.java
+12
-12
DependencyManagementPluginActionIntegrationTests.java
...gin/DependencyManagementPluginActionIntegrationTests.java
+4
-4
JavaPluginActionIntegrationTests.java
.../boot/gradle/plugin/JavaPluginActionIntegrationTests.java
+14
-14
KotlinPluginActionIntegrationTests.java
...oot/gradle/plugin/KotlinPluginActionIntegrationTests.java
+5
-5
MavenPluginActionIntegrationTests.java
...boot/gradle/plugin/MavenPluginActionIntegrationTests.java
+2
-2
OnlyDependencyManagementIntegrationTests.java
...adle/plugin/OnlyDependencyManagementIntegrationTests.java
+2
-2
WarPluginActionIntegrationTests.java
...k/boot/gradle/plugin/WarPluginActionIntegrationTests.java
+6
-6
BuildInfoIntegrationTests.java
...oot/gradle/tasks/buildinfo/BuildInfoIntegrationTests.java
+7
-7
AbstractBootArchiveIntegrationTests.java
...e/tasks/bundling/AbstractBootArchiveIntegrationTests.java
+11
-12
BootJarIntegrationTests.java
...k/boot/gradle/tasks/bundling/BootJarIntegrationTests.java
+2
-2
BootWarIntegrationTests.java
...k/boot/gradle/tasks/bundling/BootWarIntegrationTests.java
+2
-2
MavenIntegrationTests.java
...ork/boot/gradle/tasks/bundling/MavenIntegrationTests.java
+3
-3
MavenPublishingIntegrationTests.java
...radle/tasks/bundling/MavenPublishingIntegrationTests.java
+3
-3
BootRunIntegrationTests.java
...mework/boot/gradle/tasks/run/BootRunIntegrationTests.java
+9
-9
No files found.
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/GettingStartedDocumentationTests.java
View file @
47b47c28
...
@@ -29,7 +29,7 @@ import org.springframework.boot.gradle.testkit.GradleBuild;
...
@@ -29,7 +29,7 @@ import org.springframework.boot.gradle.testkit.GradleBuild;
* @author Jean-Baptiste Nizet
* @author Jean-Baptiste Nizet
*/
*/
@ExtendWith
(
GradleMultiDslExtension
.
class
)
@ExtendWith
(
GradleMultiDslExtension
.
class
)
public
class
GettingStartedDocumentationTests
{
class
GettingStartedDocumentationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
...
@@ -37,7 +37,7 @@ public class GettingStartedDocumentationTests {
...
@@ -37,7 +37,7 @@ public class GettingStartedDocumentationTests {
// jar won't be there
// jar won't be there
@TestTemplate
@TestTemplate
public
void
typicalPluginsAppliesExceptedPlugins
()
{
void
typicalPluginsAppliesExceptedPlugins
()
{
this
.
gradleBuild
.
script
(
"src/main/gradle/getting-started/typical-plugins"
).
build
(
"verify"
);
this
.
gradleBuild
.
script
(
"src/main/gradle/getting-started/typical-plugins"
).
build
(
"verify"
);
}
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/IntegratingWithActuatorDocumentationTests.java
View file @
47b47c28
...
@@ -36,19 +36,19 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -36,19 +36,19 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Jean-Baptiste Nizet
* @author Jean-Baptiste Nizet
*/
*/
@ExtendWith
(
GradleMultiDslExtension
.
class
)
@ExtendWith
(
GradleMultiDslExtension
.
class
)
public
class
IntegratingWithActuatorDocumentationTests
{
class
IntegratingWithActuatorDocumentationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
@TestTemplate
@TestTemplate
public
void
basicBuildInfo
()
throws
IOException
{
void
basicBuildInfo
()
throws
IOException
{
this
.
gradleBuild
.
script
(
"src/main/gradle/integrating-with-actuator/build-info-basic"
).
build
(
"bootBuildInfo"
);
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"
))
assertThat
(
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/resources/main/META-INF/build-info.properties"
))
.
isFile
();
.
isFile
();
}
}
@TestTemplate
@TestTemplate
public
void
buildInfoCustomValues
()
throws
IOException
{
void
buildInfoCustomValues
()
throws
IOException
{
this
.
gradleBuild
.
script
(
"src/main/gradle/integrating-with-actuator/build-info-custom-values"
)
this
.
gradleBuild
.
script
(
"src/main/gradle/integrating-with-actuator/build-info-custom-values"
)
.
build
(
"bootBuildInfo"
);
.
build
(
"bootBuildInfo"
);
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/resources/main/META-INF/build-info.properties"
);
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/resources/main/META-INF/build-info.properties"
);
...
@@ -61,7 +61,7 @@ public class IntegratingWithActuatorDocumentationTests {
...
@@ -61,7 +61,7 @@ public class IntegratingWithActuatorDocumentationTests {
}
}
@TestTemplate
@TestTemplate
public
void
buildInfoAdditional
()
throws
IOException
{
void
buildInfoAdditional
()
throws
IOException
{
this
.
gradleBuild
.
script
(
"src/main/gradle/integrating-with-actuator/build-info-additional"
)
this
.
gradleBuild
.
script
(
"src/main/gradle/integrating-with-actuator/build-info-additional"
)
.
build
(
"bootBuildInfo"
);
.
build
(
"bootBuildInfo"
);
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/resources/main/META-INF/build-info.properties"
);
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
View file @
47b47c28
...
@@ -33,29 +33,29 @@ import static org.junit.jupiter.api.Assumptions.assumingThat;
...
@@ -33,29 +33,29 @@ import static org.junit.jupiter.api.Assumptions.assumingThat;
* @author Jean-Baptiste Nizet
* @author Jean-Baptiste Nizet
*/
*/
@ExtendWith
(
GradleMultiDslExtension
.
class
)
@ExtendWith
(
GradleMultiDslExtension
.
class
)
public
class
ManagingDependenciesDocumentationTests
{
class
ManagingDependenciesDocumentationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
@TestTemplate
@TestTemplate
public
void
dependenciesExampleEvaluatesSuccessfully
()
{
void
dependenciesExampleEvaluatesSuccessfully
()
{
this
.
gradleBuild
.
script
(
"src/main/gradle/managing-dependencies/dependencies"
).
build
();
this
.
gradleBuild
.
script
(
"src/main/gradle/managing-dependencies/dependencies"
).
build
();
}
}
@TestTemplate
@TestTemplate
public
void
customManagedVersions
()
{
void
customManagedVersions
()
{
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/managing-dependencies/custom-version"
).
build
(
"slf4jVersion"
)
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/managing-dependencies/custom-version"
).
build
(
"slf4jVersion"
)
.
getOutput
()).
contains
(
"1.7.20"
);
.
getOutput
()).
contains
(
"1.7.20"
);
}
}
@TestTemplate
@TestTemplate
public
void
dependencyManagementInIsolation
()
{
void
dependencyManagementInIsolation
()
{
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/managing-dependencies/configure-bom"
)
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/managing-dependencies/configure-bom"
)
.
build
(
"dependencyManagement"
).
getOutput
()).
contains
(
"org.springframework.boot:spring-boot-starter "
);
.
build
(
"dependencyManagement"
).
getOutput
()).
contains
(
"org.springframework.boot:spring-boot-starter "
);
}
}
@TestTemplate
@TestTemplate
public
void
dependencyManagementInIsolationWithPluginsBlock
()
{
void
dependencyManagementInIsolationWithPluginsBlock
()
{
assumingThat
(
this
.
gradleBuild
.
getDsl
()
==
Dsl
.
KOTLIN
,
assumingThat
(
this
.
gradleBuild
.
getDsl
()
==
Dsl
.
KOTLIN
,
()
->
assertThat
(
()
->
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/managing-dependencies/configure-bom-with-plugins"
)
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
View file @
47b47c28
...
@@ -43,17 +43,17 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -43,17 +43,17 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Jean-Baptiste Nizet
* @author Jean-Baptiste Nizet
*/
*/
@ExtendWith
(
GradleMultiDslExtension
.
class
)
@ExtendWith
(
GradleMultiDslExtension
.
class
)
public
class
PackagingDocumentationTests
{
class
PackagingDocumentationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
@TestTemplate
@TestTemplate
public
void
warContainerDependencyEvaluatesSuccessfully
()
{
void
warContainerDependencyEvaluatesSuccessfully
()
{
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/war-container-dependency"
).
build
();
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/war-container-dependency"
).
build
();
}
}
@TestTemplate
@TestTemplate
public
void
bootJarMainClass
()
throws
IOException
{
void
bootJarMainClass
()
throws
IOException
{
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/boot-jar-main-class"
).
build
(
"bootJar"
);
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/boot-jar-main-class"
).
build
(
"bootJar"
);
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/libs/"
+
this
.
gradleBuild
.
getProjectDir
().
getName
()
+
".jar"
);
"build/libs/"
+
this
.
gradleBuild
.
getProjectDir
().
getName
()
+
".jar"
);
...
@@ -65,7 +65,7 @@ public class PackagingDocumentationTests {
...
@@ -65,7 +65,7 @@ public class PackagingDocumentationTests {
}
}
@TestTemplate
@TestTemplate
public
void
bootJarManifestMainClass
()
throws
IOException
{
void
bootJarManifestMainClass
()
throws
IOException
{
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/boot-jar-manifest-main-class"
).
build
(
"bootJar"
);
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/boot-jar-manifest-main-class"
).
build
(
"bootJar"
);
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/libs/"
+
this
.
gradleBuild
.
getProjectDir
().
getName
()
+
".jar"
);
"build/libs/"
+
this
.
gradleBuild
.
getProjectDir
().
getName
()
+
".jar"
);
...
@@ -77,7 +77,7 @@ public class PackagingDocumentationTests {
...
@@ -77,7 +77,7 @@ public class PackagingDocumentationTests {
}
}
@TestTemplate
@TestTemplate
public
void
applicationPluginMainClass
()
throws
IOException
{
void
applicationPluginMainClass
()
throws
IOException
{
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/application-plugin-main-class"
).
build
(
"bootJar"
);
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/application-plugin-main-class"
).
build
(
"bootJar"
);
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/libs/"
+
this
.
gradleBuild
.
getProjectDir
().
getName
()
+
".jar"
);
"build/libs/"
+
this
.
gradleBuild
.
getProjectDir
().
getName
()
+
".jar"
);
...
@@ -89,7 +89,7 @@ public class PackagingDocumentationTests {
...
@@ -89,7 +89,7 @@ public class PackagingDocumentationTests {
}
}
@TestTemplate
@TestTemplate
public
void
springBootDslMainClass
()
throws
IOException
{
void
springBootDslMainClass
()
throws
IOException
{
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/spring-boot-dsl-main-class"
).
build
(
"bootJar"
);
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/spring-boot-dsl-main-class"
).
build
(
"bootJar"
);
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/libs/"
+
this
.
gradleBuild
.
getProjectDir
().
getName
()
+
".jar"
);
"build/libs/"
+
this
.
gradleBuild
.
getProjectDir
().
getName
()
+
".jar"
);
...
@@ -101,7 +101,7 @@ public class PackagingDocumentationTests {
...
@@ -101,7 +101,7 @@ public class PackagingDocumentationTests {
}
}
@TestTemplate
@TestTemplate
public
void
bootWarIncludeDevtools
()
throws
IOException
{
void
bootWarIncludeDevtools
()
throws
IOException
{
jarFile
(
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"spring-boot-devtools-1.2.3.RELEASE.jar"
));
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"
);
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/boot-war-include-devtools"
).
build
(
"bootWar"
);
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
...
@@ -113,7 +113,7 @@ public class PackagingDocumentationTests {
...
@@ -113,7 +113,7 @@ public class PackagingDocumentationTests {
}
}
@TestTemplate
@TestTemplate
public
void
bootJarRequiresUnpack
()
throws
IOException
{
void
bootJarRequiresUnpack
()
throws
IOException
{
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/boot-jar-requires-unpack"
).
build
(
"bootJar"
);
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/boot-jar-requires-unpack"
).
build
(
"bootJar"
);
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/libs/"
+
this
.
gradleBuild
.
getProjectDir
().
getName
()
+
".jar"
);
"build/libs/"
+
this
.
gradleBuild
.
getProjectDir
().
getName
()
+
".jar"
);
...
@@ -126,7 +126,7 @@ public class PackagingDocumentationTests {
...
@@ -126,7 +126,7 @@ public class PackagingDocumentationTests {
}
}
@TestTemplate
@TestTemplate
public
void
bootJarIncludeLaunchScript
()
throws
IOException
{
void
bootJarIncludeLaunchScript
()
throws
IOException
{
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/boot-jar-include-launch-script"
).
build
(
"bootJar"
);
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/boot-jar-include-launch-script"
).
build
(
"bootJar"
);
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/libs/"
+
this
.
gradleBuild
.
getProjectDir
().
getName
()
+
".jar"
);
"build/libs/"
+
this
.
gradleBuild
.
getProjectDir
().
getName
()
+
".jar"
);
...
@@ -135,7 +135,7 @@ public class PackagingDocumentationTests {
...
@@ -135,7 +135,7 @@ public class PackagingDocumentationTests {
}
}
@TestTemplate
@TestTemplate
public
void
bootJarLaunchScriptProperties
()
throws
IOException
{
void
bootJarLaunchScriptProperties
()
throws
IOException
{
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/boot-jar-launch-script-properties"
).
build
(
"bootJar"
);
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/boot-jar-launch-script-properties"
).
build
(
"bootJar"
);
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/libs/"
+
this
.
gradleBuild
.
getProjectDir
().
getName
()
+
".jar"
);
"build/libs/"
+
this
.
gradleBuild
.
getProjectDir
().
getName
()
+
".jar"
);
...
@@ -144,7 +144,7 @@ public class PackagingDocumentationTests {
...
@@ -144,7 +144,7 @@ public class PackagingDocumentationTests {
}
}
@TestTemplate
@TestTemplate
public
void
bootJarCustomLaunchScript
()
throws
IOException
{
void
bootJarCustomLaunchScript
()
throws
IOException
{
File
customScriptFile
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"src/custom.script"
);
File
customScriptFile
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"src/custom.script"
);
customScriptFile
.
getParentFile
().
mkdirs
();
customScriptFile
.
getParentFile
().
mkdirs
();
FileCopyUtils
.
copy
(
"custom"
,
new
FileWriter
(
customScriptFile
));
FileCopyUtils
.
copy
(
"custom"
,
new
FileWriter
(
customScriptFile
));
...
@@ -156,7 +156,7 @@ public class PackagingDocumentationTests {
...
@@ -156,7 +156,7 @@ public class PackagingDocumentationTests {
}
}
@TestTemplate
@TestTemplate
public
void
bootWarPropertiesLauncher
()
throws
IOException
{
void
bootWarPropertiesLauncher
()
throws
IOException
{
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/boot-war-properties-launcher"
).
build
(
"bootWar"
);
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/boot-war-properties-launcher"
).
build
(
"bootWar"
);
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
File
file
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/libs/"
+
this
.
gradleBuild
.
getProjectDir
().
getName
()
+
".war"
);
"build/libs/"
+
this
.
gradleBuild
.
getProjectDir
().
getName
()
+
".war"
);
...
@@ -168,7 +168,7 @@ public class PackagingDocumentationTests {
...
@@ -168,7 +168,7 @@ public class PackagingDocumentationTests {
}
}
@TestTemplate
@TestTemplate
public
void
bootJarAndJar
()
{
void
bootJarAndJar
()
{
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/boot-jar-and-jar"
).
build
(
"assemble"
);
this
.
gradleBuild
.
script
(
"src/main/gradle/packaging/boot-jar-and-jar"
).
build
(
"assemble"
);
File
jar
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
File
jar
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/libs/"
+
this
.
gradleBuild
.
getProjectDir
().
getName
()
+
".jar"
);
"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
View file @
47b47c28
...
@@ -33,18 +33,18 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -33,18 +33,18 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Jean-Baptiste Nizet
* @author Jean-Baptiste Nizet
*/
*/
@ExtendWith
(
GradleMultiDslExtension
.
class
)
@ExtendWith
(
GradleMultiDslExtension
.
class
)
public
class
PublishingDocumentationTests
{
class
PublishingDocumentationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
@TestTemplate
@TestTemplate
public
void
mavenUpload
()
throws
IOException
{
void
mavenUpload
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/publishing/maven"
).
build
(
"deployerRepository"
).
getOutput
())
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/publishing/maven"
).
build
(
"deployerRepository"
).
getOutput
())
.
contains
(
"https://repo.example.com"
);
.
contains
(
"https://repo.example.com"
);
}
}
@TestTemplate
@TestTemplate
public
void
mavenPublish
()
throws
IOException
{
void
mavenPublish
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/publishing/maven-publish"
).
build
(
"publishingConfiguration"
)
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/publishing/maven-publish"
).
build
(
"publishingConfiguration"
)
.
getOutput
()).
contains
(
"MavenPublication"
).
contains
(
"https://repo.example.com"
);
.
getOutput
()).
contains
(
"MavenPublication"
).
contains
(
"https://repo.example.com"
);
}
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/RunningDocumentationTests.java
View file @
47b47c28
...
@@ -34,36 +34,36 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -34,36 +34,36 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Jean-Baptiste Nizet
* @author Jean-Baptiste Nizet
*/
*/
@ExtendWith
(
GradleMultiDslExtension
.
class
)
@ExtendWith
(
GradleMultiDslExtension
.
class
)
public
class
RunningDocumentationTests
{
class
RunningDocumentationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
@TestTemplate
@TestTemplate
public
void
bootRunMain
()
throws
IOException
{
void
bootRunMain
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/running/boot-run-main"
).
build
(
"configuredMainClass"
)
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/running/boot-run-main"
).
build
(
"configuredMainClass"
)
.
getOutput
()).
contains
(
"com.example.ExampleApplication"
);
.
getOutput
()).
contains
(
"com.example.ExampleApplication"
);
}
}
@TestTemplate
@TestTemplate
public
void
applicationPluginMainClassName
()
{
void
applicationPluginMainClassName
()
{
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/running/application-plugin-main-class-name"
)
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/running/application-plugin-main-class-name"
)
.
build
(
"configuredMainClass"
).
getOutput
()).
contains
(
"com.example.ExampleApplication"
);
.
build
(
"configuredMainClass"
).
getOutput
()).
contains
(
"com.example.ExampleApplication"
);
}
}
@TestTemplate
@TestTemplate
public
void
springBootDslMainClassName
()
throws
IOException
{
void
springBootDslMainClassName
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/running/spring-boot-dsl-main-class-name"
)
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/running/spring-boot-dsl-main-class-name"
)
.
build
(
"configuredMainClass"
).
getOutput
()).
contains
(
"com.example.ExampleApplication"
);
.
build
(
"configuredMainClass"
).
getOutput
()).
contains
(
"com.example.ExampleApplication"
);
}
}
@TestTemplate
@TestTemplate
public
void
bootRunSourceResources
()
throws
IOException
{
void
bootRunSourceResources
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/running/boot-run-source-resources"
)
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/running/boot-run-source-resources"
)
.
build
(
"configuredClasspath"
).
getOutput
()).
contains
(
new
File
(
"src/main/resources"
).
getPath
());
.
build
(
"configuredClasspath"
).
getOutput
()).
contains
(
new
File
(
"src/main/resources"
).
getPath
());
}
}
@TestTemplate
@TestTemplate
public
void
bootRunDisableOptimizedLaunch
()
throws
IOException
{
void
bootRunDisableOptimizedLaunch
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/running/boot-run-disable-optimized-launch"
)
assertThat
(
this
.
gradleBuild
.
script
(
"src/main/gradle/running/boot-run-disable-optimized-launch"
)
.
build
(
"optimizedLaunch"
).
getOutput
()).
contains
(
"false"
);
.
build
(
"optimizedLaunch"
).
getOutput
()).
contains
(
"false"
);
}
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/ApplicationPluginActionIntegrationTests.java
View file @
47b47c28
...
@@ -43,42 +43,42 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -43,42 +43,42 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
* @author Andy Wilkinson
*/
*/
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
public
class
ApplicationPluginActionIntegrationTests
{
class
ApplicationPluginActionIntegrationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
@TestTemplate
@TestTemplate
public
void
noBootDistributionWithoutApplicationPluginApplied
()
{
void
noBootDistributionWithoutApplicationPluginApplied
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"distributionExists"
,
"-PdistributionName=boot"
).
getOutput
())
assertThat
(
this
.
gradleBuild
.
build
(
"distributionExists"
,
"-PdistributionName=boot"
).
getOutput
())
.
contains
(
"boot exists = false"
);
.
contains
(
"boot exists = false"
);
}
}
@TestTemplate
@TestTemplate
public
void
applyingApplicationPluginCreatesBootDistribution
()
{
void
applyingApplicationPluginCreatesBootDistribution
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"distributionExists"
,
"-PdistributionName=boot"
,
"-PapplyApplicationPlugin"
)
assertThat
(
this
.
gradleBuild
.
build
(
"distributionExists"
,
"-PdistributionName=boot"
,
"-PapplyApplicationPlugin"
)
.
getOutput
()).
contains
(
"boot exists = true"
);
.
getOutput
()).
contains
(
"boot exists = true"
);
}
}
@TestTemplate
@TestTemplate
public
void
noBootStartScriptsTaskWithoutApplicationPluginApplied
()
{
void
noBootStartScriptsTaskWithoutApplicationPluginApplied
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"taskExists"
,
"-PtaskName=bootStartScripts"
).
getOutput
())
assertThat
(
this
.
gradleBuild
.
build
(
"taskExists"
,
"-PtaskName=bootStartScripts"
).
getOutput
())
.
contains
(
"bootStartScripts exists = false"
);
.
contains
(
"bootStartScripts exists = false"
);
}
}
@TestTemplate
@TestTemplate
public
void
applyingApplicationPluginCreatesBootStartScriptsTask
()
{
void
applyingApplicationPluginCreatesBootStartScriptsTask
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"taskExists"
,
"-PtaskName=bootStartScripts"
,
"-PapplyApplicationPlugin"
)
assertThat
(
this
.
gradleBuild
.
build
(
"taskExists"
,
"-PtaskName=bootStartScripts"
,
"-PapplyApplicationPlugin"
)
.
getOutput
()).
contains
(
"bootStartScripts exists = true"
);
.
getOutput
()).
contains
(
"bootStartScripts exists = true"
);
}
}
@TestTemplate
@TestTemplate
public
void
createsBootStartScriptsTaskUsesApplicationPluginsDefaultJvmOpts
()
{
void
createsBootStartScriptsTaskUsesApplicationPluginsDefaultJvmOpts
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"startScriptsDefaultJvmOpts"
,
"-PapplyApplicationPlugin"
).
getOutput
())
assertThat
(
this
.
gradleBuild
.
build
(
"startScriptsDefaultJvmOpts"
,
"-PapplyApplicationPlugin"
).
getOutput
())
.
contains
(
"bootStartScripts defaultJvmOpts = [-Dcom.example.a=alpha, -Dcom.example.b=bravo]"
);
.
contains
(
"bootStartScripts defaultJvmOpts = [-Dcom.example.a=alpha, -Dcom.example.b=bravo]"
);
}
}
@TestTemplate
@TestTemplate
public
void
zipDistributionForJarCanBeBuilt
()
throws
IOException
{
void
zipDistributionForJarCanBeBuilt
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistZip"
).
task
(
":bootDistZip"
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistZip"
).
task
(
":bootDistZip"
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
String
name
=
this
.
gradleBuild
.
getProjectDir
().
getName
();
String
name
=
this
.
gradleBuild
.
getProjectDir
().
getName
();
...
@@ -90,7 +90,7 @@ public class ApplicationPluginActionIntegrationTests {
...
@@ -90,7 +90,7 @@ public class ApplicationPluginActionIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
tarDistributionForJarCanBeBuilt
()
throws
IOException
{
void
tarDistributionForJarCanBeBuilt
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistTar"
).
task
(
":bootDistTar"
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistTar"
).
task
(
":bootDistTar"
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
String
name
=
this
.
gradleBuild
.
getProjectDir
().
getName
();
String
name
=
this
.
gradleBuild
.
getProjectDir
().
getName
();
...
@@ -102,7 +102,7 @@ public class ApplicationPluginActionIntegrationTests {
...
@@ -102,7 +102,7 @@ public class ApplicationPluginActionIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
zipDistributionForWarCanBeBuilt
()
throws
IOException
{
void
zipDistributionForWarCanBeBuilt
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistZip"
).
task
(
":bootDistZip"
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistZip"
).
task
(
":bootDistZip"
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
String
name
=
this
.
gradleBuild
.
getProjectDir
().
getName
();
String
name
=
this
.
gradleBuild
.
getProjectDir
().
getName
();
...
@@ -114,7 +114,7 @@ public class ApplicationPluginActionIntegrationTests {
...
@@ -114,7 +114,7 @@ public class ApplicationPluginActionIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
tarDistributionForWarCanBeBuilt
()
throws
IOException
{
void
tarDistributionForWarCanBeBuilt
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistTar"
).
task
(
":bootDistTar"
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistTar"
).
task
(
":bootDistTar"
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
String
name
=
this
.
gradleBuild
.
getProjectDir
().
getName
();
String
name
=
this
.
gradleBuild
.
getProjectDir
().
getName
();
...
@@ -126,7 +126,7 @@ public class ApplicationPluginActionIntegrationTests {
...
@@ -126,7 +126,7 @@ public class ApplicationPluginActionIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
applicationNameCanBeUsedToCustomizeDistributionName
()
throws
IOException
{
void
applicationNameCanBeUsedToCustomizeDistributionName
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistTar"
).
task
(
":bootDistTar"
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistTar"
).
task
(
":bootDistTar"
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
File
distribution
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/distributions/custom-boot.tar"
);
File
distribution
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/distributions/custom-boot.tar"
);
...
@@ -138,7 +138,7 @@ public class ApplicationPluginActionIntegrationTests {
...
@@ -138,7 +138,7 @@ public class ApplicationPluginActionIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
scriptsHaveCorrectPermissions
()
throws
IOException
{
void
scriptsHaveCorrectPermissions
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistTar"
).
task
(
":bootDistTar"
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
"bootDistTar"
).
task
(
":bootDistTar"
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
String
name
=
this
.
gradleBuild
.
getProjectDir
().
getName
();
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
View file @
47b47c28
...
@@ -37,24 +37,24 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -37,24 +37,24 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
* @author Andy Wilkinson
*/
*/
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
public
class
DependencyManagementPluginActionIntegrationTests
{
class
DependencyManagementPluginActionIntegrationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
@TestTemplate
@TestTemplate
public
void
noDependencyManagementIsAppliedByDefault
()
{
void
noDependencyManagementIsAppliedByDefault
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"doesNotHaveDependencyManagement"
).
task
(
":doesNotHaveDependencyManagement"
)
assertThat
(
this
.
gradleBuild
.
build
(
"doesNotHaveDependencyManagement"
).
task
(
":doesNotHaveDependencyManagement"
)
.
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
}
}
@TestTemplate
@TestTemplate
public
void
bomIsImportedWhenDependencyManagementPluginIsApplied
()
{
void
bomIsImportedWhenDependencyManagementPluginIsApplied
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"hasDependencyManagement"
,
"-PapplyDependencyManagementPlugin"
)
assertThat
(
this
.
gradleBuild
.
build
(
"hasDependencyManagement"
,
"-PapplyDependencyManagementPlugin"
)
.
task
(
":hasDependencyManagement"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
task
(
":hasDependencyManagement"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
}
}
@TestTemplate
@TestTemplate
public
void
helpfulErrorWhenVersionlessDependencyFailsToResolve
()
throws
IOException
{
void
helpfulErrorWhenVersionlessDependencyFailsToResolve
()
throws
IOException
{
File
examplePackage
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"src/main/java/com/example"
);
File
examplePackage
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"src/main/java/com/example"
);
examplePackage
.
mkdirs
();
examplePackage
.
mkdirs
();
FileSystemUtils
.
copyRecursively
(
new
File
(
"src/test/java/com/example"
),
examplePackage
);
FileSystemUtils
.
copyRecursively
(
new
File
(
"src/test/java/com/example"
),
examplePackage
);
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/JavaPluginActionIntegrationTests.java
View file @
47b47c28
...
@@ -37,77 +37,77 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -37,77 +37,77 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
* @author Andy Wilkinson
*/
*/
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
public
class
JavaPluginActionIntegrationTests
{
class
JavaPluginActionIntegrationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
@TestTemplate
@TestTemplate
public
void
noBootJarTaskWithoutJavaPluginApplied
()
{
void
noBootJarTaskWithoutJavaPluginApplied
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"taskExists"
,
"-PtaskName=bootJar"
).
getOutput
())
assertThat
(
this
.
gradleBuild
.
build
(
"taskExists"
,
"-PtaskName=bootJar"
).
getOutput
())
.
contains
(
"bootJar exists = false"
);
.
contains
(
"bootJar exists = false"
);
}
}
@TestTemplate
@TestTemplate
public
void
applyingJavaPluginCreatesBootJarTask
()
{
void
applyingJavaPluginCreatesBootJarTask
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"taskExists"
,
"-PtaskName=bootJar"
,
"-PapplyJavaPlugin"
).
getOutput
())
assertThat
(
this
.
gradleBuild
.
build
(
"taskExists"
,
"-PtaskName=bootJar"
,
"-PapplyJavaPlugin"
).
getOutput
())
.
contains
(
"bootJar exists = true"
);
.
contains
(
"bootJar exists = true"
);
}
}
@TestTemplate
@TestTemplate
public
void
noBootRunTaskWithoutJavaPluginApplied
()
{
void
noBootRunTaskWithoutJavaPluginApplied
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"taskExists"
,
"-PtaskName=bootRun"
).
getOutput
())
assertThat
(
this
.
gradleBuild
.
build
(
"taskExists"
,
"-PtaskName=bootRun"
).
getOutput
())
.
contains
(
"bootRun exists = false"
);
.
contains
(
"bootRun exists = false"
);
}
}
@TestTemplate
@TestTemplate
public
void
applyingJavaPluginCreatesBootRunTask
()
{
void
applyingJavaPluginCreatesBootRunTask
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"taskExists"
,
"-PtaskName=bootRun"
,
"-PapplyJavaPlugin"
).
getOutput
())
assertThat
(
this
.
gradleBuild
.
build
(
"taskExists"
,
"-PtaskName=bootRun"
,
"-PapplyJavaPlugin"
).
getOutput
())
.
contains
(
"bootRun exists = true"
);
.
contains
(
"bootRun exists = true"
);
}
}
@TestTemplate
@TestTemplate
public
void
javaCompileTasksUseUtf8Encoding
()
{
void
javaCompileTasksUseUtf8Encoding
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"javaCompileEncoding"
,
"-PapplyJavaPlugin"
).
getOutput
())
assertThat
(
this
.
gradleBuild
.
build
(
"javaCompileEncoding"
,
"-PapplyJavaPlugin"
).
getOutput
())
.
contains
(
"compileJava = UTF-8"
).
contains
(
"compileTestJava = UTF-8"
);
.
contains
(
"compileJava = UTF-8"
).
contains
(
"compileTestJava = UTF-8"
);
}
}
@TestTemplate
@TestTemplate
public
void
javaCompileTasksUseParametersCompilerFlagByDefault
()
{
void
javaCompileTasksUseParametersCompilerFlagByDefault
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"javaCompileTasksCompilerArgs"
).
getOutput
())
assertThat
(
this
.
gradleBuild
.
build
(
"javaCompileTasksCompilerArgs"
).
getOutput
())
.
contains
(
"compileJava compiler args: [-parameters]"
)
.
contains
(
"compileJava compiler args: [-parameters]"
)
.
contains
(
"compileTestJava compiler args: [-parameters]"
);
.
contains
(
"compileTestJava compiler args: [-parameters]"
);
}
}
@TestTemplate
@TestTemplate
public
void
javaCompileTasksUseParametersAndAdditionalCompilerFlags
()
{
void
javaCompileTasksUseParametersAndAdditionalCompilerFlags
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"javaCompileTasksCompilerArgs"
).
getOutput
())
assertThat
(
this
.
gradleBuild
.
build
(
"javaCompileTasksCompilerArgs"
).
getOutput
())
.
contains
(
"compileJava compiler args: [-parameters, -Xlint:all]"
)
.
contains
(
"compileJava compiler args: [-parameters, -Xlint:all]"
)
.
contains
(
"compileTestJava compiler args: [-parameters, -Xlint:all]"
);
.
contains
(
"compileTestJava compiler args: [-parameters, -Xlint:all]"
);
}
}
@TestTemplate
@TestTemplate
public
void
javaCompileTasksCanOverrideDefaultParametersCompilerFlag
()
{
void
javaCompileTasksCanOverrideDefaultParametersCompilerFlag
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"javaCompileTasksCompilerArgs"
).
getOutput
())
assertThat
(
this
.
gradleBuild
.
build
(
"javaCompileTasksCompilerArgs"
).
getOutput
())
.
contains
(
"compileJava compiler args: [-Xlint:all]"
)
.
contains
(
"compileJava compiler args: [-Xlint:all]"
)
.
contains
(
"compileTestJava compiler args: [-Xlint:all]"
);
.
contains
(
"compileTestJava compiler args: [-Xlint:all]"
);
}
}
@TestTemplate
@TestTemplate
public
void
assembleRunsBootJarAndJarIsSkipped
()
{
void
assembleRunsBootJarAndJarIsSkipped
()
{
BuildResult
result
=
this
.
gradleBuild
.
build
(
"assemble"
);
BuildResult
result
=
this
.
gradleBuild
.
build
(
"assemble"
);
assertThat
(
result
.
task
(
":bootJar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":bootJar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":jar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SKIPPED
);
assertThat
(
result
.
task
(
":jar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SKIPPED
);
}
}
@TestTemplate
@TestTemplate
public
void
errorMessageIsHelpfulWhenMainClassCannotBeResolved
()
{
void
errorMessageIsHelpfulWhenMainClassCannotBeResolved
()
{
BuildResult
result
=
this
.
gradleBuild
.
buildAndFail
(
"build"
,
"-PapplyJavaPlugin"
);
BuildResult
result
=
this
.
gradleBuild
.
buildAndFail
(
"build"
,
"-PapplyJavaPlugin"
);
assertThat
(
result
.
task
(
":bootJar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
FAILED
);
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"
);
assertThat
(
result
.
getOutput
()).
contains
(
"Main class name has not been configured and it could not be resolved"
);
}
}
@TestTemplate
@TestTemplate
public
void
jarAndBootJarCanBothBeBuilt
()
{
void
jarAndBootJarCanBothBeBuilt
()
{
BuildResult
result
=
this
.
gradleBuild
.
build
(
"assemble"
);
BuildResult
result
=
this
.
gradleBuild
.
build
(
"assemble"
);
assertThat
(
result
.
task
(
":bootJar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":bootJar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":jar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":jar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
...
@@ -118,7 +118,7 @@ public class JavaPluginActionIntegrationTests {
...
@@ -118,7 +118,7 @@ public class JavaPluginActionIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
additionalMetadataLocationsConfiguredWhenProcessorIsPresent
()
throws
IOException
{
void
additionalMetadataLocationsConfiguredWhenProcessorIsPresent
()
throws
IOException
{
createMinimalMainSource
();
createMinimalMainSource
();
File
libs
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"libs"
);
File
libs
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"libs"
);
libs
.
mkdirs
();
libs
.
mkdirs
();
...
@@ -132,7 +132,7 @@ public class JavaPluginActionIntegrationTests {
...
@@ -132,7 +132,7 @@ public class JavaPluginActionIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
additionalMetadataLocationsNotConfiguredWhenProcessorIsAbsent
()
throws
IOException
{
void
additionalMetadataLocationsNotConfiguredWhenProcessorIsAbsent
()
throws
IOException
{
createMinimalMainSource
();
createMinimalMainSource
();
BuildResult
result
=
this
.
gradleBuild
.
build
(
"compileJava"
);
BuildResult
result
=
this
.
gradleBuild
.
build
(
"compileJava"
);
assertThat
(
result
.
task
(
":compileJava"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":compileJava"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/KotlinPluginActionIntegrationTests.java
View file @
47b47c28
...
@@ -30,30 +30,30 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -30,30 +30,30 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
* @author Andy Wilkinson
*/
*/
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
public
class
KotlinPluginActionIntegrationTests
{
class
KotlinPluginActionIntegrationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
@TestTemplate
@TestTemplate
public
void
noKotlinVersionPropertyWithoutKotlinPlugin
()
{
void
noKotlinVersionPropertyWithoutKotlinPlugin
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"kotlinVersion"
).
getOutput
()).
contains
(
"Kotlin version: none"
);
assertThat
(
this
.
gradleBuild
.
build
(
"kotlinVersion"
).
getOutput
()).
contains
(
"Kotlin version: none"
);
}
}
@TestTemplate
@TestTemplate
public
void
kotlinVersionPropertyIsSet
()
{
void
kotlinVersionPropertyIsSet
()
{
String
output
=
this
.
gradleBuild
.
build
(
"kotlinVersion"
,
"dependencies"
,
"--configuration"
,
"compileClasspath"
)
String
output
=
this
.
gradleBuild
.
build
(
"kotlinVersion"
,
"dependencies"
,
"--configuration"
,
"compileClasspath"
)
.
getOutput
();
.
getOutput
();
assertThat
(
output
).
containsPattern
(
"Kotlin version: [0-9]\\.[0-9]\\.[0-9]+"
);
assertThat
(
output
).
containsPattern
(
"Kotlin version: [0-9]\\.[0-9]\\.[0-9]+"
);
}
}
@TestTemplate
@TestTemplate
public
void
kotlinCompileTasksUseJavaParametersFlagByDefault
()
{
void
kotlinCompileTasksUseJavaParametersFlagByDefault
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"kotlinCompileTasksJavaParameters"
).
getOutput
())
assertThat
(
this
.
gradleBuild
.
build
(
"kotlinCompileTasksJavaParameters"
).
getOutput
())
.
contains
(
"compileKotlin java parameters: true"
).
contains
(
"compileTestKotlin java parameters: true"
);
.
contains
(
"compileKotlin java parameters: true"
).
contains
(
"compileTestKotlin java parameters: true"
);
}
}
@TestTemplate
@TestTemplate
public
void
kotlinCompileTasksCanOverrideDefaultJavaParametersFlag
()
{
void
kotlinCompileTasksCanOverrideDefaultJavaParametersFlag
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"kotlinCompileTasksJavaParameters"
).
getOutput
())
assertThat
(
this
.
gradleBuild
.
build
(
"kotlinCompileTasksJavaParameters"
).
getOutput
())
.
contains
(
"compileKotlin java parameters: false"
).
contains
(
"compileTestKotlin java parameters: false"
);
.
contains
(
"compileKotlin java parameters: false"
).
contains
(
"compileTestKotlin java parameters: false"
);
}
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/MavenPluginActionIntegrationTests.java
View file @
47b47c28
...
@@ -30,12 +30,12 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -30,12 +30,12 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
* @author Andy Wilkinson
*/
*/
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
public
class
MavenPluginActionIntegrationTests
{
class
MavenPluginActionIntegrationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
@TestTemplate
@TestTemplate
public
void
clearsConf2ScopeMappingsOfUploadBootArchivesTask
()
{
void
clearsConf2ScopeMappingsOfUploadBootArchivesTask
()
{
assertThat
(
this
.
gradleBuild
.
expectDeprecationWarningsWithAtLeastVersion
(
"6.0.0"
).
build
(
"conf2ScopeMappings"
)
assertThat
(
this
.
gradleBuild
.
expectDeprecationWarningsWithAtLeastVersion
(
"6.0.0"
).
build
(
"conf2ScopeMappings"
)
.
getOutput
()).
contains
(
"Conf2ScopeMappings = 0"
);
.
getOutput
()).
contains
(
"Conf2ScopeMappings = 0"
);
}
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/OnlyDependencyManagementIntegrationTests.java
View file @
47b47c28
...
@@ -31,12 +31,12 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -31,12 +31,12 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
* @author Andy Wilkinson
*/
*/
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
public
class
OnlyDependencyManagementIntegrationTests
{
class
OnlyDependencyManagementIntegrationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
@TestTemplate
@TestTemplate
public
void
dependencyManagementCanBeConfiguredUsingCoordinatesConstant
()
{
void
dependencyManagementCanBeConfiguredUsingCoordinatesConstant
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"dependencyManagement"
).
getOutput
())
assertThat
(
this
.
gradleBuild
.
build
(
"dependencyManagement"
).
getOutput
())
.
contains
(
"org.springframework.boot:spring-boot-starter "
);
.
contains
(
"org.springframework.boot:spring-boot-starter "
);
}
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/WarPluginActionIntegrationTests.java
View file @
47b47c28
...
@@ -34,31 +34,31 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -34,31 +34,31 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
* @author Andy Wilkinson
*/
*/
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
public
class
WarPluginActionIntegrationTests
{
class
WarPluginActionIntegrationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
@TestTemplate
@TestTemplate
public
void
noBootWarTaskWithoutWarPluginApplied
()
{
void
noBootWarTaskWithoutWarPluginApplied
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"taskExists"
,
"-PtaskName=bootWar"
).
getOutput
())
assertThat
(
this
.
gradleBuild
.
build
(
"taskExists"
,
"-PtaskName=bootWar"
).
getOutput
())
.
contains
(
"bootWar exists = false"
);
.
contains
(
"bootWar exists = false"
);
}
}
@TestTemplate
@TestTemplate
public
void
applyingWarPluginCreatesBootWarTask
()
{
void
applyingWarPluginCreatesBootWarTask
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"taskExists"
,
"-PtaskName=bootWar"
,
"-PapplyWarPlugin"
).
getOutput
())
assertThat
(
this
.
gradleBuild
.
build
(
"taskExists"
,
"-PtaskName=bootWar"
,
"-PapplyWarPlugin"
).
getOutput
())
.
contains
(
"bootWar exists = true"
);
.
contains
(
"bootWar exists = true"
);
}
}
@TestTemplate
@TestTemplate
public
void
assembleRunsBootWarAndWarIsSkipped
()
{
void
assembleRunsBootWarAndWarIsSkipped
()
{
BuildResult
result
=
this
.
gradleBuild
.
build
(
"assemble"
);
BuildResult
result
=
this
.
gradleBuild
.
build
(
"assemble"
);
assertThat
(
result
.
task
(
":bootWar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":bootWar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":war"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SKIPPED
);
assertThat
(
result
.
task
(
":war"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SKIPPED
);
}
}
@TestTemplate
@TestTemplate
public
void
warAndBootWarCanBothBeBuilt
()
{
void
warAndBootWarCanBothBeBuilt
()
{
BuildResult
result
=
this
.
gradleBuild
.
build
(
"assemble"
);
BuildResult
result
=
this
.
gradleBuild
.
build
(
"assemble"
);
assertThat
(
result
.
task
(
":bootWar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":bootWar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":war"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":war"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
...
@@ -69,7 +69,7 @@ public class WarPluginActionIntegrationTests {
...
@@ -69,7 +69,7 @@ public class WarPluginActionIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
errorMessageIsHelpfulWhenMainClassCannotBeResolved
()
{
void
errorMessageIsHelpfulWhenMainClassCannotBeResolved
()
{
BuildResult
result
=
this
.
gradleBuild
.
buildAndFail
(
"build"
,
"-PapplyWarPlugin"
);
BuildResult
result
=
this
.
gradleBuild
.
buildAndFail
(
"build"
,
"-PapplyWarPlugin"
);
assertThat
(
result
.
task
(
":bootWar"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
FAILED
);
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"
);
assertThat
(
result
.
getOutput
()).
contains
(
"Main class name has not been configured and it could not be resolved"
);
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfoIntegrationTests.java
View file @
47b47c28
...
@@ -40,12 +40,12 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -40,12 +40,12 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
* @author Andy Wilkinson
*/
*/
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
public
class
BuildInfoIntegrationTests
{
class
BuildInfoIntegrationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
@TestTemplate
@TestTemplate
public
void
defaultValues
()
{
void
defaultValues
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"buildInfo"
).
task
(
":buildInfo"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
build
(
"buildInfo"
).
task
(
":buildInfo"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
Properties
buildInfoProperties
=
buildInfoProperties
();
Properties
buildInfoProperties
=
buildInfoProperties
();
assertThat
(
buildInfoProperties
).
containsKey
(
"build.time"
);
assertThat
(
buildInfoProperties
).
containsKey
(
"build.time"
);
...
@@ -56,7 +56,7 @@ public class BuildInfoIntegrationTests {
...
@@ -56,7 +56,7 @@ public class BuildInfoIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
basicExecution
()
{
void
basicExecution
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"buildInfo"
).
task
(
":buildInfo"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
build
(
"buildInfo"
).
task
(
":buildInfo"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
Properties
buildInfoProperties
=
buildInfoProperties
();
Properties
buildInfoProperties
=
buildInfoProperties
();
assertThat
(
buildInfoProperties
).
containsKey
(
"build.time"
);
assertThat
(
buildInfoProperties
).
containsKey
(
"build.time"
);
...
@@ -68,13 +68,13 @@ public class BuildInfoIntegrationTests {
...
@@ -68,13 +68,13 @@ public class BuildInfoIntegrationTests {
}
}
@TestTemplate
@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
);
assertThat
(
this
.
gradleBuild
.
build
(
"buildInfo"
).
task
(
":buildInfo"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
build
(
"buildInfo"
).
task
(
":buildInfo"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
}
}
@TestTemplate
@TestTemplate
public
void
upToDateWhenExecutedTwiceWithFixedTime
()
{
void
upToDateWhenExecutedTwiceWithFixedTime
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"buildInfo"
,
"-PnullTime"
).
task
(
":buildInfo"
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
"buildInfo"
,
"-PnullTime"
).
task
(
":buildInfo"
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
build
(
"buildInfo"
,
"-PnullTime"
).
task
(
":buildInfo"
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
"buildInfo"
,
"-PnullTime"
).
task
(
":buildInfo"
).
getOutcome
())
...
@@ -82,7 +82,7 @@ public class BuildInfoIntegrationTests {
...
@@ -82,7 +82,7 @@ public class BuildInfoIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
notUpToDateWhenExecutedTwiceWithFixedTimeAndChangedProjectVersion
()
{
void
notUpToDateWhenExecutedTwiceWithFixedTimeAndChangedProjectVersion
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"buildInfo"
,
"-PnullTime"
).
task
(
":buildInfo"
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
"buildInfo"
,
"-PnullTime"
).
task
(
":buildInfo"
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
BuildResult
result
=
this
.
gradleBuild
.
build
(
"buildInfo"
,
"-PnullTime"
,
"-PprojectVersion=0.2.0"
);
BuildResult
result
=
this
.
gradleBuild
.
build
(
"buildInfo"
,
"-PnullTime"
,
"-PprojectVersion=0.2.0"
);
...
@@ -90,7 +90,7 @@ public class BuildInfoIntegrationTests {
...
@@ -90,7 +90,7 @@ public class BuildInfoIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
reproducibleOutputWithFixedTime
()
void
reproducibleOutputWithFixedTime
()
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
,
IOException
,
InterruptedException
{
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
,
IOException
,
InterruptedException
{
assertThat
(
this
.
gradleBuild
.
build
(
"buildInfo"
,
"-PnullTime"
).
task
(
":buildInfo"
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
"buildInfo"
,
"-PnullTime"
).
task
(
":buildInfo"
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java
View file @
47b47c28
...
@@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
* @author Andy Wilkinson
*/
*/
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
public
abstract
class
AbstractBootArchiveIntegrationTests
{
abstract
class
AbstractBootArchiveIntegrationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
...
@@ -49,13 +49,13 @@ public abstract class AbstractBootArchiveIntegrationTests {
...
@@ -49,13 +49,13 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
basicBuild
()
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
,
IOException
{
void
basicBuild
()
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
,
IOException
{
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
}
}
@TestTemplate
@TestTemplate
public
void
reproducibleArchive
()
void
reproducibleArchive
()
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
,
IOException
,
InterruptedException
{
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
,
IOException
,
InterruptedException
{
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
...
@@ -69,8 +69,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
...
@@ -69,8 +69,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
upToDateWhenBuiltTwice
()
void
upToDateWhenBuiltTwice
()
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
,
IOException
{
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
,
IOException
{
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
...
@@ -78,7 +77,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
...
@@ -78,7 +77,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
upToDateWhenBuiltTwiceWithLaunchScriptIncluded
()
void
upToDateWhenBuiltTwiceWithLaunchScriptIncluded
()
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
,
IOException
{
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
,
IOException
{
assertThat
(
this
.
gradleBuild
.
build
(
"-PincludeLaunchScript=true"
,
this
.
taskName
).
task
(
":"
+
this
.
taskName
)
assertThat
(
this
.
gradleBuild
.
build
(
"-PincludeLaunchScript=true"
,
this
.
taskName
).
task
(
":"
+
this
.
taskName
)
.
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
...
@@ -87,7 +86,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
...
@@ -87,7 +86,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
notUpToDateWhenLaunchScriptWasNotIncludedAndThenIsIncluded
()
{
void
notUpToDateWhenLaunchScriptWasNotIncludedAndThenIsIncluded
()
{
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
build
(
"-PincludeLaunchScript=true"
,
this
.
taskName
).
task
(
":"
+
this
.
taskName
)
assertThat
(
this
.
gradleBuild
.
build
(
"-PincludeLaunchScript=true"
,
this
.
taskName
).
task
(
":"
+
this
.
taskName
)
...
@@ -95,7 +94,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
...
@@ -95,7 +94,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
notUpToDateWhenLaunchScriptWasIncludedAndThenIsNotIncluded
()
{
void
notUpToDateWhenLaunchScriptWasIncludedAndThenIsNotIncluded
()
{
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
build
(
"-PincludeLaunchScript=true"
,
this
.
taskName
).
task
(
":"
+
this
.
taskName
)
assertThat
(
this
.
gradleBuild
.
build
(
"-PincludeLaunchScript=true"
,
this
.
taskName
).
task
(
":"
+
this
.
taskName
)
...
@@ -103,7 +102,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
...
@@ -103,7 +102,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
notUpToDateWhenLaunchScriptPropertyChanges
()
{
void
notUpToDateWhenLaunchScriptPropertyChanges
()
{
assertThat
(
this
.
gradleBuild
.
build
(
"-PincludeLaunchScript=true"
,
"-PlaunchScriptProperty=foo"
,
this
.
taskName
)
assertThat
(
this
.
gradleBuild
.
build
(
"-PincludeLaunchScript=true"
,
"-PlaunchScriptProperty=foo"
,
this
.
taskName
)
.
task
(
":"
+
this
.
taskName
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
task
(
":"
+
this
.
taskName
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
build
(
"-PincludeLaunchScript=true"
,
"-PlaunchScriptProperty=bar"
,
this
.
taskName
)
assertThat
(
this
.
gradleBuild
.
build
(
"-PincludeLaunchScript=true"
,
"-PlaunchScriptProperty=bar"
,
this
.
taskName
)
...
@@ -111,7 +110,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
...
@@ -111,7 +110,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
applicationPluginMainClassNameIsUsed
()
throws
IOException
{
void
applicationPluginMainClassNameIsUsed
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
try
(
JarFile
jarFile
=
new
JarFile
(
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/libs"
).
listFiles
()[
0
]))
{
try
(
JarFile
jarFile
=
new
JarFile
(
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/libs"
).
listFiles
()[
0
]))
{
...
@@ -121,7 +120,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
...
@@ -121,7 +120,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
springBootExtensionMainClassNameIsUsed
()
throws
IOException
{
void
springBootExtensionMainClassNameIsUsed
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
try
(
JarFile
jarFile
=
new
JarFile
(
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/libs"
).
listFiles
()[
0
]))
{
try
(
JarFile
jarFile
=
new
JarFile
(
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/libs"
).
listFiles
()[
0
]))
{
...
@@ -131,7 +130,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
...
@@ -131,7 +130,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
duplicatesAreHandledGracefully
()
throws
IOException
{
void
duplicatesAreHandledGracefully
()
throws
IOException
{
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
}
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests.java
View file @
47b47c28
...
@@ -21,9 +21,9 @@ package org.springframework.boot.gradle.tasks.bundling;
...
@@ -21,9 +21,9 @@ package org.springframework.boot.gradle.tasks.bundling;
*
*
* @author Andy Wilkinson
* @author Andy Wilkinson
*/
*/
public
class
BootJarIntegrationTests
extends
AbstractBootArchiveIntegrationTests
{
class
BootJarIntegrationTests
extends
AbstractBootArchiveIntegrationTests
{
public
BootJarIntegrationTests
()
{
BootJarIntegrationTests
()
{
super
(
"bootJar"
);
super
(
"bootJar"
);
}
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarIntegrationTests.java
View file @
47b47c28
...
@@ -21,9 +21,9 @@ package org.springframework.boot.gradle.tasks.bundling;
...
@@ -21,9 +21,9 @@ package org.springframework.boot.gradle.tasks.bundling;
*
*
* @author Andy Wilkinson
* @author Andy Wilkinson
*/
*/
public
class
BootWarIntegrationTests
extends
AbstractBootArchiveIntegrationTests
{
class
BootWarIntegrationTests
extends
AbstractBootArchiveIntegrationTests
{
public
BootWarIntegrationTests
()
{
BootWarIntegrationTests
()
{
super
(
"bootWar"
);
super
(
"bootWar"
);
}
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/MavenIntegrationTests.java
View file @
47b47c28
...
@@ -36,12 +36,12 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -36,12 +36,12 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
* @author Andy Wilkinson
*/
*/
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
public
class
MavenIntegrationTests
{
class
MavenIntegrationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
@TestTemplate
@TestTemplate
public
void
bootJarCanBeUploaded
()
throws
FileNotFoundException
,
IOException
{
void
bootJarCanBeUploaded
()
throws
FileNotFoundException
,
IOException
{
BuildResult
result
=
this
.
gradleBuild
.
expectDeprecationWarningsWithAtLeastVersion
(
"6.0.0"
)
BuildResult
result
=
this
.
gradleBuild
.
expectDeprecationWarningsWithAtLeastVersion
(
"6.0.0"
)
.
build
(
"uploadBootArchives"
);
.
build
(
"uploadBootArchives"
);
assertThat
(
result
.
task
(
":uploadBootArchives"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":uploadBootArchives"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
...
@@ -51,7 +51,7 @@ public class MavenIntegrationTests {
...
@@ -51,7 +51,7 @@ public class MavenIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
bootWarCanBeUploaded
()
throws
IOException
{
void
bootWarCanBeUploaded
()
throws
IOException
{
BuildResult
result
=
this
.
gradleBuild
.
expectDeprecationWarningsWithAtLeastVersion
(
"6.0.0"
)
BuildResult
result
=
this
.
gradleBuild
.
expectDeprecationWarningsWithAtLeastVersion
(
"6.0.0"
)
.
build
(
"uploadBootArchives"
);
.
build
(
"uploadBootArchives"
);
assertThat
(
result
.
task
(
":uploadBootArchives"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":uploadBootArchives"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/MavenPublishingIntegrationTests.java
View file @
47b47c28
...
@@ -37,12 +37,12 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -37,12 +37,12 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
* @author Andy Wilkinson
*/
*/
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
public
class
MavenPublishingIntegrationTests
{
class
MavenPublishingIntegrationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
@TestTemplate
@TestTemplate
public
void
bootJarCanBePublished
()
throws
FileNotFoundException
,
IOException
{
void
bootJarCanBePublished
()
throws
FileNotFoundException
,
IOException
{
BuildResult
result
=
this
.
gradleBuild
.
build
(
"publish"
);
BuildResult
result
=
this
.
gradleBuild
.
build
(
"publish"
);
assertThat
(
result
.
task
(
":publish"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":publish"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
artifactWithSuffix
(
"jar"
)).
isFile
();
assertThat
(
artifactWithSuffix
(
"jar"
)).
isFile
();
...
@@ -51,7 +51,7 @@ public class MavenPublishingIntegrationTests {
...
@@ -51,7 +51,7 @@ public class MavenPublishingIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
bootWarCanBePublished
()
throws
IOException
{
void
bootWarCanBePublished
()
throws
IOException
{
BuildResult
result
=
this
.
gradleBuild
.
build
(
"publish"
);
BuildResult
result
=
this
.
gradleBuild
.
build
(
"publish"
);
assertThat
(
result
.
task
(
":publish"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":publish"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
artifactWithSuffix
(
"war"
)).
isFile
();
assertThat
(
artifactWithSuffix
(
"war"
)).
isFile
();
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/run/BootRunIntegrationTests.java
View file @
47b47c28
...
@@ -36,12 +36,12 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -36,12 +36,12 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
* @author Andy Wilkinson
*/
*/
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
@ExtendWith
(
GradleCompatibilityExtension
.
class
)
public
class
BootRunIntegrationTests
{
class
BootRunIntegrationTests
{
GradleBuild
gradleBuild
;
GradleBuild
gradleBuild
;
@TestTemplate
@TestTemplate
public
void
basicExecution
()
throws
IOException
{
void
basicExecution
()
throws
IOException
{
copyClasspathApplication
();
copyClasspathApplication
();
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"src/main/resources"
).
mkdirs
();
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"src/main/resources"
).
mkdirs
();
BuildResult
result
=
this
.
gradleBuild
.
build
(
"bootRun"
);
BuildResult
result
=
this
.
gradleBuild
.
build
(
"bootRun"
);
...
@@ -52,7 +52,7 @@ public class BootRunIntegrationTests {
...
@@ -52,7 +52,7 @@ public class BootRunIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
sourceResourcesCanBeUsed
()
throws
IOException
{
void
sourceResourcesCanBeUsed
()
throws
IOException
{
copyClasspathApplication
();
copyClasspathApplication
();
BuildResult
result
=
this
.
gradleBuild
.
build
(
"bootRun"
);
BuildResult
result
=
this
.
gradleBuild
.
build
(
"bootRun"
);
assertThat
(
result
.
task
(
":bootRun"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":bootRun"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
...
@@ -62,21 +62,21 @@ public class BootRunIntegrationTests {
...
@@ -62,21 +62,21 @@ public class BootRunIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
springBootExtensionMainClassNameIsUsed
()
throws
IOException
{
void
springBootExtensionMainClassNameIsUsed
()
throws
IOException
{
BuildResult
result
=
this
.
gradleBuild
.
build
(
"echoMainClassName"
);
BuildResult
result
=
this
.
gradleBuild
.
build
(
"echoMainClassName"
);
assertThat
(
result
.
task
(
":echoMainClassName"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
UP_TO_DATE
);
assertThat
(
result
.
task
(
":echoMainClassName"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
UP_TO_DATE
);
assertThat
(
result
.
getOutput
()).
contains
(
"Main class name = com.example.CustomMainClass"
);
assertThat
(
result
.
getOutput
()).
contains
(
"Main class name = com.example.CustomMainClass"
);
}
}
@TestTemplate
@TestTemplate
public
void
applicationPluginMainClassNameIsUsed
()
throws
IOException
{
void
applicationPluginMainClassNameIsUsed
()
throws
IOException
{
BuildResult
result
=
this
.
gradleBuild
.
build
(
"echoMainClassName"
);
BuildResult
result
=
this
.
gradleBuild
.
build
(
"echoMainClassName"
);
assertThat
(
result
.
task
(
":echoMainClassName"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
UP_TO_DATE
);
assertThat
(
result
.
task
(
":echoMainClassName"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
UP_TO_DATE
);
assertThat
(
result
.
getOutput
()).
contains
(
"Main class name = com.example.CustomMainClass"
);
assertThat
(
result
.
getOutput
()).
contains
(
"Main class name = com.example.CustomMainClass"
);
}
}
@TestTemplate
@TestTemplate
public
void
applicationPluginMainClassNameIsNotUsedWhenItIsNull
()
throws
IOException
{
void
applicationPluginMainClassNameIsNotUsedWhenItIsNull
()
throws
IOException
{
copyClasspathApplication
();
copyClasspathApplication
();
BuildResult
result
=
this
.
gradleBuild
.
build
(
"echoMainClassName"
);
BuildResult
result
=
this
.
gradleBuild
.
build
(
"echoMainClassName"
);
assertThat
(
result
.
task
(
":echoMainClassName"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":echoMainClassName"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
...
@@ -84,7 +84,7 @@ public class BootRunIntegrationTests {
...
@@ -84,7 +84,7 @@ public class BootRunIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
defaultJvmArgs
()
throws
IOException
{
void
defaultJvmArgs
()
throws
IOException
{
copyJvmArgsApplication
();
copyJvmArgsApplication
();
BuildResult
result
=
this
.
gradleBuild
.
build
(
"bootRun"
);
BuildResult
result
=
this
.
gradleBuild
.
build
(
"bootRun"
);
assertThat
(
result
.
task
(
":bootRun"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":bootRun"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
...
@@ -92,7 +92,7 @@ public class BootRunIntegrationTests {
...
@@ -92,7 +92,7 @@ public class BootRunIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
optimizedLaunchDisabledJvmArgs
()
throws
IOException
{
void
optimizedLaunchDisabledJvmArgs
()
throws
IOException
{
copyJvmArgsApplication
();
copyJvmArgsApplication
();
BuildResult
result
=
this
.
gradleBuild
.
build
(
"bootRun"
);
BuildResult
result
=
this
.
gradleBuild
.
build
(
"bootRun"
);
assertThat
(
result
.
task
(
":bootRun"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":bootRun"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
...
@@ -100,7 +100,7 @@ public class BootRunIntegrationTests {
...
@@ -100,7 +100,7 @@ public class BootRunIntegrationTests {
}
}
@TestTemplate
@TestTemplate
public
void
applicationPluginJvmArgumentsAreUsed
()
throws
IOException
{
void
applicationPluginJvmArgumentsAreUsed
()
throws
IOException
{
copyJvmArgsApplication
();
copyJvmArgsApplication
();
BuildResult
result
=
this
.
gradleBuild
.
build
(
"bootRun"
);
BuildResult
result
=
this
.
gradleBuild
.
build
(
"bootRun"
);
assertThat
(
result
.
task
(
":bootRun"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
result
.
task
(
":bootRun"
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment