Skip to content

Commit 9448da8

Browse files
Merge pull request #307 from java9-modularity/test-clean-up
Clean up smoke test case
2 parents 1ebe200 + aa54fc3 commit 9448da8

File tree

47 files changed

+25
-679
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+25
-679
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@ updates:
3636
open-pull-requests-limit: 50
3737
schedule:
3838
interval: monthly
39-
- package-ecosystem: gradle
40-
directory: /test-project-kotlin-pre-1-7
41-
open-pull-requests-limit: 50
42-
schedule:
43-
interval: monthly
44-
ignore:
45-
- dependency-name: "org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin"
46-
# This pre-Kotlin-1.7 project must not have the Kotlin major version updated:
47-
update-types: [ "version-update:semver-major" ]
4839
- package-ecosystem: gradle
4940
directory: /test-project-mixed
5041
open-pull-requests-limit: 50

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ The plugin currently supports:
2222

2323
The plugin supports the following test engines:
2424

25-
* JUnit 5
26-
* JUnit 4
25+
* JUnit 5 (for JUnit versions before 5.8.0 use plugin version v1.8.15, higher versions of JUnit 5 can use the latest version of the plugin)
26+
* JUnit 4 (Use plugin version v1.8.15)
2727
* TestNG
2828
* ![Since 1.7.0](https://img.shields.io/badge/since-1.7.0-brightgreen) Spock 2 with Groovy 3
2929
* ![Since 1.7.0](https://img.shields.io/badge/since-1.7.0-brightgreen) AssertJ
@@ -102,10 +102,10 @@ subprojects {
102102
}
103103
104104
dependencies {
105-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
106-
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.2'
107-
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
108-
testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.10.2"
105+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.14.0'
106+
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.14.0'
107+
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.14.0'
108+
testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.14.0"
109109
}
110110
}
111111
```
@@ -144,10 +144,10 @@ subprojects {
144144
}
145145

146146
dependencies {
147-
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1")
148-
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.2")
149-
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.2")
150-
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.10.2")
147+
testImplementation("org.junit.jupiter:junit-jupiter-api:5.14.0")
148+
testImplementation("org.junit.jupiter:junit-jupiter-params:5.14.0")
149+
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.14.0")
150+
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.14.0")
151151
}
152152
}
153153
```

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ configurations {
3131
compile.extendsFrom plugin
3232
}
3333

34-
def jUnitVersion = '5.10.2'
34+
def jUnitVersion = '5.14.0'
3535

3636
dependencies {
3737
implementation gradleApi()

src/test/java/org/javamodularity/moduleplugin/ModulePluginSmokeTest.java

Lines changed: 3 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ModulePluginSmokeTest {
3636
@SuppressWarnings("unused")
3737
private enum GradleVersion {
3838
v8_11, v8_14_3,
39-
v9_0, v9_1_0
39+
v9_0, v9_2_0
4040
;
4141

4242
@Override
@@ -58,14 +58,11 @@ void before() throws IOException {
5858
void smokeTest(
5959
@CartesianTest.Values(strings = {
6060
"test-project",
61-
"test-project-kotlin-pre-1-7",
6261
"test-project-kotlin",
6362
"test-project-groovy"
6463
}) String projectName,
6564
@CartesianTest.Enum GradleVersion gradleVersion) {
6665
LOGGER.lifecycle("Executing smokeTest of {} with Gradle {}", projectName, gradleVersion);
67-
assumeTrue(jdkSupported(gradleVersion));
68-
assumeTrue(checkKotlinCombination(projectName, gradleVersion));
6966
var result = GradleRunner.create()
7067
.withProjectDir(new File(projectName + "/"))
7168
.withPluginClasspath(pluginClasspath)
@@ -88,14 +85,11 @@ void smokeTest(
8885
void smokeTestRun(
8986
@CartesianTest.Values(strings = {
9087
"test-project",
91-
"test-project-kotlin-pre-1-7",
9288
"test-project-kotlin",
9389
"test-project-groovy"
9490
}) String projectName,
9591
@CartesianTest.Enum GradleVersion gradleVersion) {
9692
LOGGER.lifecycle("Executing smokeTestRun of {} with Gradle {}", projectName, gradleVersion);
97-
assumeTrue(jdkSupported(gradleVersion));
98-
assumeTrue(checkKotlinCombination(projectName, gradleVersion));
9993
var writer = new StringWriter(256);
10094
var result = GradleRunner.create()
10195
.withProjectDir(new File(projectName + "/"))
@@ -117,18 +111,14 @@ void smokeTestRun(
117111
@CartesianTest(name = "smokeTestJunit5({arguments})")
118112
void smokeTestJunit5(
119113
@CartesianTest.Values(strings = {
120-
"5.4.2/1.4.2",
121-
"5.5.2/1.5.2",
122-
"5.7.1/1.7.1",
123114
"5.8.0/1.8.0",
124-
"5.10.2/1.10.2"
115+
"5.10.2/1.10.2",
116+
"5.14.0/1.14.0"
125117
}) String junitVersionPair,
126118
@CartesianTest.Enum GradleVersion gradleVersion) {
127119
LOGGER.lifecycle("Executing smokeTestJunit5 with junitVersionPair {} and Gradle {}", junitVersionPair, gradleVersion);
128-
assumeTrue(jdkSupported(gradleVersion));
129120
var junitVersionParts = junitVersionPair.split("/");
130121
final String junitVersion = junitVersionParts[0];
131-
assumeTrue(checkJUnitCombination(junitVersion, gradleVersion));
132122
var junitVersionProperty = String.format("-PjUnitVersion=%s", junitVersion);
133123
var junitPlatformVersionProperty = String.format("-PjUnitPlatformVersion=%s", junitVersionParts[1]);
134124
var result = GradleRunner.create()
@@ -148,7 +138,6 @@ void smokeTestJunit5(
148138
@CartesianTest(name = "smokeTestMixed({arguments})")
149139
void smokeTestMixed(@CartesianTest.Enum GradleVersion gradleVersion) {
150140
LOGGER.lifecycle("Executing smokeTestMixed with Gradle {}", gradleVersion);
151-
assumeTrue(jdkSupported(gradleVersion));
152141
var result = GradleRunner.create()
153142
.withProjectDir(new File("test-project-mixed"))
154143
.withPluginClasspath(pluginClasspath)
@@ -200,14 +189,11 @@ private static void assertExpectedClassFileFormats(
200189
void smokeTestDist(
201190
@CartesianTest.Values(strings = {
202191
"test-project",
203-
"test-project-kotlin-pre-1-7",
204192
"test-project-kotlin",
205193
"test-project-groovy"
206194
}) String projectName,
207195
@CartesianTest.Enum GradleVersion gradleVersion) {
208196
LOGGER.lifecycle("Executing smokeTestDist of {} with Gradle {}", projectName, gradleVersion);
209-
assumeTrue(jdkSupported(gradleVersion));
210-
assumeTrue(checkKotlinCombination(projectName, gradleVersion));
211197
var result = GradleRunner.create()
212198
.withProjectDir(new File(projectName + "/"))
213199
.withPluginClasspath(pluginClasspath)
@@ -247,14 +233,11 @@ void smokeTestDist(
247233
void smokeTestRunDemo(
248234
@CartesianTest.Values(strings = {
249235
"test-project",
250-
"test-project-kotlin-pre-1-7",
251236
"test-project-kotlin",
252237
"test-project-groovy"
253238
}) String projectName,
254239
@CartesianTest.Enum GradleVersion gradleVersion) {
255240
LOGGER.lifecycle("Executing smokeTestRunDemo of {} with Gradle {}", projectName, gradleVersion);
256-
assumeTrue(jdkSupported(gradleVersion));
257-
assumeTrue(checkKotlinCombination(projectName, gradleVersion));
258241
var result = GradleRunner.create()
259242
.withProjectDir(new File(projectName + "/"))
260243
.withPluginClasspath(pluginClasspath)
@@ -272,14 +255,11 @@ void smokeTestRunDemo(
272255
void smokeTestRunStartScripts(
273256
@CartesianTest.Values(strings = {
274257
"test-project",
275-
"test-project-kotlin-pre-1-7",
276258
"test-project-kotlin",
277259
"test-project-groovy"
278260
}) String projectName,
279261
@CartesianTest.Enum GradleVersion gradleVersion) {
280262
LOGGER.lifecycle("Executing smokeTestRunScripts of {} with Gradle {}", projectName, gradleVersion);
281-
assumeTrue(jdkSupported(gradleVersion));
282-
assumeTrue(checkKotlinCombination(projectName, gradleVersion));
283263
var result = GradleRunner.create()
284264
.withProjectDir(new File(projectName + "/"))
285265
.withPluginClasspath(pluginClasspath)
@@ -313,54 +293,4 @@ private static void assertOutputDoesNotContain(BuildResult result, String text)
313293
final String output = result.getOutput();
314294
assertFalse(output.contains(text), "Output should not contain '" + text + "', but was: " + output);
315295
}
316-
317-
private static boolean checkKotlinCombination(String projectName, GradleVersion gradleVersion) {
318-
final boolean kotlin_NotSupported = projectName.startsWith("test-project-kotlin") && gradleVersion.toString().compareTo("6.4") < 0;
319-
final boolean kotlinPost1_7_NotSupported = projectName.equals("test-project-kotlin") && gradleVersion.toString().compareTo("6.6") < 0;
320-
final boolean kotlinPre1_7_NotSupported = projectName.equals("test-project-kotlin-pre-1-7") && gradleVersion.toString().compareTo("8.0") >= 0;
321-
if (kotlin_NotSupported || kotlinPost1_7_NotSupported || kotlinPre1_7_NotSupported) {
322-
LOGGER.lifecycle("Unsupported combination: {} / Gradle {}. Test skipped", projectName, gradleVersion);
323-
return false;
324-
}
325-
return true;
326-
}
327-
328-
private boolean checkJUnitCombination(final String junitVersion, final GradleVersion gradleVersion) {
329-
final boolean gradleEighthPlus = gradleVersion.ordinal() >= GradleVersion.v8_11.ordinal();
330-
final Matcher m = SEMANTIC_VERSION.matcher(junitVersion);
331-
assumeTrue(m.matches(), "JUnit version not semantic: " + junitVersion);
332-
final boolean junitOlderThan5_8_0 = Integer.parseInt(m.group("major")) < 5 ||
333-
(Integer.parseInt(m.group("major")) == 5 && Integer.parseInt(m.group("minor")) < 8);
334-
335-
if (gradleEighthPlus && junitOlderThan5_8_0) {
336-
LOGGER.lifecycle("Unsupported JUnit and Gradle combination. Gradle: {}, JUnit: {}: Test skipped", gradleVersion, junitVersion);
337-
return false;
338-
}
339-
return true;
340-
}
341-
342-
private static int javaMajorVersion() {
343-
final String version = System.getProperty("java.version");
344-
345-
// Java 9+ (9.0.1, 11.0.2, 17.0.2 format)
346-
int dotIndex = version.indexOf(".");
347-
if (dotIndex == -1) {
348-
// Handle cases like "17" without dot
349-
return Integer.parseInt(version);
350-
}
351-
352-
return Integer.parseInt(version.substring(0, dotIndex));
353-
}
354-
355-
private boolean jdkSupported(final GradleVersion gradleVersion) {
356-
final int javaMajor = javaMajorVersion();
357-
358-
// All supported Gradle versions (8.11+) require Java 17+
359-
if (javaMajor < 17) {
360-
LOGGER.lifecycle("Gradle {} requires Java 17+, but running Java {}: Test skipped", gradleVersion, javaMajor);
361-
return false;
362-
}
363-
364-
return true;
365-
}
366296
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
jUnitVersion = 5.10.2
2-
jUnitPlatformVersion = 1.10.2
1+
jUnitVersion = 5.14.0
2+
jUnitPlatformVersion = 1.14.0

test-project-kotlin-pre-1-7/README.md

Lines changed: 0 additions & 40 deletions
This file was deleted.

test-project-kotlin-pre-1-7/build.gradle.kts

Lines changed: 0 additions & 64 deletions
This file was deleted.

test-project-kotlin-pre-1-7/gradle.properties

Lines changed: 0 additions & 2 deletions
This file was deleted.

test-project-kotlin-pre-1-7/greeter.api/build.gradle.kts

Lines changed: 0 additions & 21 deletions
This file was deleted.

test-project-kotlin-pre-1-7/greeter.api/src/main/java/module-info.java

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)