File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
prometheus-metrics-instrumentation-jvm/src/test/java/io/prometheus/metrics/instrumentation/jvm Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change 22
33import static io .prometheus .metrics .instrumentation .jvm .TestUtil .convertToOpenMetricsFormat ;
44import static org .assertj .core .api .Assertions .assertThat ;
5+ import static org .assertj .core .api .Assumptions .assumeThat ;
56import static org .mockito .Mockito .times ;
67import static org .mockito .Mockito .verify ;
78import 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 {
You can’t perform that action at this time.
0 commit comments