From 47bcd56c57416b30000bbfe0f024bbdd516fda56 Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Wed, 4 Sep 2024 14:54:39 +0300 Subject: [PATCH] Keep junit extensions in static fields --- .../awssdk/v2_2/Aws2ClientNotRecordHttpErrorTest.java | 3 ++- .../opentelemetry/javaagent/instrumentation/rmi/RmiTest.java | 2 +- .../security/config/v6_0/EnduserAttributesCapturerTest.java | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/library/src/test/java/io/opentelemetry/instrumentation/awssdk/v2_2/Aws2ClientNotRecordHttpErrorTest.java b/instrumentation/aws-sdk/aws-sdk-2.2/library/src/test/java/io/opentelemetry/instrumentation/awssdk/v2_2/Aws2ClientNotRecordHttpErrorTest.java index c4f8b4eb5f70..c40d83d97e6d 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/library/src/test/java/io/opentelemetry/instrumentation/awssdk/v2_2/Aws2ClientNotRecordHttpErrorTest.java +++ b/instrumentation/aws-sdk/aws-sdk-2.2/library/src/test/java/io/opentelemetry/instrumentation/awssdk/v2_2/Aws2ClientNotRecordHttpErrorTest.java @@ -12,7 +12,8 @@ public class Aws2ClientNotRecordHttpErrorTest extends AbstractAws2ClientRecordHttpErrorTest { @RegisterExtension - public final LibraryInstrumentationExtension testing = LibraryInstrumentationExtension.create(); + public static final LibraryInstrumentationExtension testing = + LibraryInstrumentationExtension.create(); @Override public ClientOverrideConfiguration.Builder createOverrideConfigurationBuilder() { diff --git a/instrumentation/rmi/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/rmi/RmiTest.java b/instrumentation/rmi/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/rmi/RmiTest.java index 927acf4c4606..f604e9df0382 100644 --- a/instrumentation/rmi/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/rmi/RmiTest.java +++ b/instrumentation/rmi/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/rmi/RmiTest.java @@ -37,7 +37,7 @@ class RmiTest { private static Registry serverRegistry; private static Registry clientRegistry; - @RegisterExtension final AutoCleanupExtension autoCleanup = AutoCleanupExtension.create(); + @RegisterExtension static final AutoCleanupExtension autoCleanup = AutoCleanupExtension.create(); @BeforeAll static void setUp() throws Exception { diff --git a/instrumentation/spring/spring-security-config-6.0/library/src/test/java/io/opentelemetry/instrumentation/spring/security/config/v6_0/EnduserAttributesCapturerTest.java b/instrumentation/spring/spring-security-config-6.0/library/src/test/java/io/opentelemetry/instrumentation/spring/security/config/v6_0/EnduserAttributesCapturerTest.java index 56bc62e1657f..511afc49bbbb 100644 --- a/instrumentation/spring/spring-security-config-6.0/library/src/test/java/io/opentelemetry/instrumentation/spring/security/config/v6_0/EnduserAttributesCapturerTest.java +++ b/instrumentation/spring/spring-security-config-6.0/library/src/test/java/io/opentelemetry/instrumentation/spring/security/config/v6_0/EnduserAttributesCapturerTest.java @@ -23,7 +23,8 @@ public class EnduserAttributesCapturerTest { - @RegisterExtension InstrumentationExtension testing = LibraryInstrumentationExtension.create(); + @RegisterExtension + static final InstrumentationExtension testing = LibraryInstrumentationExtension.create(); @Test void nothingEnabled() {