Skip to content

Commit 0491b21

Browse files
committed
Update tests to not contain deprecated behavior
1 parent 3f01643 commit 0491b21

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.my.lib.test;
2+
3+
class MyLibTest {
4+
5+
@org.junit.jupiter.api.Test
6+
void test() {}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.my.lib.test;
2+
3+
class MyLibTest {
4+
5+
@org.junit.jupiter.api.Test
6+
void test() {}
7+
}

src/test/java/org/gradlex/javamodule/dependencies/test/initialization/SettingsPluginIncludeTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ void can_define_included_subprojects_as_modules() {
6464

6565
@Test
6666
void can_define_included_subprojects_with_custom_project_directory_as_modules() {
67+
build.projectDir.dir("project/with/custom/path");
6768
build.settingsFile.appendText("""
6869
include(":project:with:custom:path")
6970
project(":project:with:custom:path").projectDir = file("lib")

src/test/java/org/gradlex/javamodule/dependencies/test/runtime/RequiresRuntimeTest.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,30 @@ void can_configure_additional_compile_tasks_to_work_with_runtime_only_dependenci
161161
"--module-path",
162162
classpath.files.joinToString(":"),
163163
"--patch-module",
164-
"org.gradlex.test.app=" + srcDir
164+
"org.gradlex.test.app=" + srcDir,
165+
"--add-modules",
166+
"org.junit.jupiter.api",
167+
"--add-reads",
168+
"org.gradlex.test.app=org.junit.jupiter.api"
165169
)
166170
}
167171
}
172+
tasks.test { useJUnitPlatform() }
168173
169174
dependencies.constraints {
170175
javaModuleDependencies {
171176
implementation(gav("org.slf4j", "2.0.3"))
172177
implementation(gav("org.slf4j.simple", "2.0.3"))
173178
}
174-
}""");
179+
}
180+
dependencies {
181+
javaModuleDependencies {
182+
testImplementation(gav("org.junit.jupiter.api", "5.13.4"))
183+
testRuntimeOnly(ga("org.junit.jupiter.engine"))
184+
testRuntimeOnly(ga("org.junit.platform.launcher"))
185+
}
186+
}
187+
""");
175188
build.appModuleInfoFile.writeText("""
176189
module org.gradlex.test.app {
177190
requires org.slf4j;
@@ -180,7 +193,10 @@ void can_configure_additional_compile_tasks_to_work_with_runtime_only_dependenci
180193
build.file("app/src/test/java/org/gradlex/test/app/MainTest.java").writeText("""
181194
package org.gradlex.test.app;
182195
183-
public class MainTest {}""");
196+
public class MainTest {
197+
@org.junit.jupiter.api.Test
198+
void test() {}
199+
}""");
184200

185201
var result = build.build().task(":app:compileTestJava");
186202

0 commit comments

Comments
 (0)