Skip to content

Commit b4dcbdf

Browse files
committed
cleanup
Signed-off-by: Gregor Zeitlinger <[email protected]>
1 parent b3d8f19 commit b4dcbdf

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

prometheus-metrics-instrumentation-jvm/src/test/java/io/prometheus/metrics/instrumentation/jvm/JvmThreadsMetricsTest.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import static io.prometheus.metrics.instrumentation.jvm.TestUtil.convertToOpenMetricsFormat;
44
import static org.assertj.core.api.Assertions.assertThat;
5+
import static org.assertj.core.api.Assumptions.assumeThat;
56
import static org.mockito.Mockito.times;
67
import static org.mockito.Mockito.verify;
78
import static org.mockito.Mockito.when;
@@ -106,10 +107,8 @@ public void testInvalidThreadIds() {
106107
try {
107108
String javaVersion = System.getProperty("java.version"); // Example: "21.0.2"
108109
String majorJavaVersion = javaVersion.replaceAll("\\..*", ""); // Example: "21"
109-
if (Integer.parseInt(majorJavaVersion) >= 21) {
110-
// With Java 21 and newer you can no longer have invalid thread ids.
111-
return;
112-
}
110+
// With Java 21 and newer you can no longer have invalid thread ids.
111+
assumeThat(Integer.parseInt(majorJavaVersion)).isLessThanOrEqualTo(21);
113112
} catch (NumberFormatException ignored) {
114113
// ignore
115114
}
@@ -181,14 +180,7 @@ public long getId() {
181180
}
182181
}
183182

184-
private static class TestRunnable implements Runnable {
185-
186-
private final CountDownLatch countDownLatch;
187-
188-
private TestRunnable(CountDownLatch countDownLatch) {
189-
this.countDownLatch = countDownLatch;
190-
}
191-
183+
private record TestRunnable(CountDownLatch countDownLatch) implements Runnable {
192184
@Override
193185
public void run() {
194186
try {

0 commit comments

Comments
 (0)