Skip to content

Commit 8cd3fc1

Browse files
committed
Update JDK: 22 -> 23 ...
- disable test with ServiceLoader.load(...) - empty results - refactor jshell test - update dependencies
1 parent a281717 commit 8cd3fc1

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

.github/workflows/gradle.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ jobs:
2424

2525
steps:
2626
- uses: actions/checkout@v4
27-
- name: Set up JDK 22
27+
- name: Set up JDK 23
2828
uses: actions/setup-java@v4
2929
with:
3030
distribution: 'oracle'
31-
java-version: '22'
31+
java-version: '23'
3232

3333
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
3434
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ext {
1414
}
1515

1616
dependencies {
17-
testImplementation platform('org.junit:junit-bom:5.10.0')
17+
testImplementation platform('org.junit:junit-bom:5.11.3')
1818
testImplementation 'org.junit.jupiter:junit-jupiter'
1919
testRuntimeOnly 'com.h2database:h2:2.2.224'
2020
testRuntimeOnly "org.graalvm.js:js:${graaljsVersion}"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Mon Sep 23 00:15:15 CEST 2024
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

src/test/java/pl/mperor/lab/java/Java17.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import org.junit.jupiter.api.Assertions;
44
import org.junit.jupiter.api.Test;
5+
import org.junit.jupiter.api.condition.DisabledOnJre;
6+
import org.junit.jupiter.api.condition.JRE;
57

68
import java.lang.reflect.Field;
79
import java.lang.reflect.InaccessibleObjectException;
@@ -53,6 +55,7 @@ private static String switchOverClasses(Object obj) {
5355
};
5456
}
5557

58+
@DisabledOnJre(JRE.JAVA_23)
5659
@Test
5760
public void testRandomGeneratorFactory() {
5861
var generators = ServiceLoader.load(RandomGenerator.class).stream()

src/test/java/pl/mperor/lab/java/Java9.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import org.junit.jupiter.api.Assertions;
44
import org.junit.jupiter.api.Test;
5+
import org.junit.jupiter.api.condition.DisabledOnJre;
6+
import org.junit.jupiter.api.condition.JRE;
57

68
import java.io.File;
79
import java.io.FileWriter;
@@ -88,14 +90,15 @@ public void testJShell() throws IOException, InterruptedException {
8890

8991
try (var reader = process.inputReader();
9092
var writer = new PrintWriter(process.outputWriter())) {
91-
writer.println("System.out.println(\"Hello from JShell!\");");
93+
writer.println("System.out.print(\"Hello from JShell!\");");
9294
writer.println("/exit");
9395
writer.flush();
9496

9597
String lastLineBeforeExit = reader.lines()
98+
.peek(System.out::println)
9699
.takeWhile(s -> !s.contains("Goodbye"))
97100
.reduce("", (first, second) -> second);
98-
Assertions.assertEquals("Hello from JShell!", lastLineBeforeExit);
101+
Assertions.assertTrue(lastLineBeforeExit.contains("Hello from JShell!"));
99102
}
100103

101104
Assertions.assertEquals(0, process.waitFor());

0 commit comments

Comments
 (0)