Skip to content

Commit

Permalink
Updates in test code
Browse files Browse the repository at this point in the history
  • Loading branch information
jjohannes committed Nov 18, 2024
1 parent 07282c3 commit 13c47fc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class CustomizationTest extends Specification {
def result = runTests()

then:
result.output.contains('Main Module: org.example.app')
result.output.contains('Test Module: org.example.app')
result.task(":app:test").outcome == TaskOutcome.SUCCESS
}

Expand Down Expand Up @@ -74,6 +76,8 @@ class CustomizationTest extends Specification {
def result = runTests()

then:
result.output.contains('Main Module: org.example.app')
result.output.contains('Test Module: org.example.app.test')
result.task(":app:test").outcome == TaskOutcome.SUCCESS
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class GradleBuild {

settingsFile << '''
pluginManagement {
plugins { id("org.gradlex.java-module-dependencies") version "1.5.2" }
plugins { id("org.gradlex.java-module-dependencies") version "1.8" }
}
dependencyResolutionManagement { repositories.mavenCentral() }
includeBuild(".")
Expand All @@ -56,6 +56,9 @@ class GradleBuild {
mainModule.set("org.example.app")
mainClass.set("org.example.app.Main")
}
tasks.test {
testLogging.showStandardStreams = true
}
"""
file("app/src/main/java/org/example/app/Main.java") << '''
package org.example.app;
Expand All @@ -76,6 +79,8 @@ class GradleBuild {
@Test
void testApp() {
new Main();
System.out.println("Main Module: " + Main.class.getModule().getName());
System.out.println("Test Module: " + MainTest.class.getModule().getName());
}
}
'''
Expand Down Expand Up @@ -110,7 +115,7 @@ class GradleBuild {
}

BuildResult runTests() {
runner(':app:test', '-q').build()
runner(':app:test').build()
}

BuildResult fail() {
Expand Down

0 comments on commit 13c47fc

Please sign in to comment.