diff --git a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpAsyncClientTest.java b/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpAsyncClientTest.java index f3e1d067a07f..588ebc659fb7 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpAsyncClientTest.java +++ b/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpAsyncClientTest.java @@ -19,6 +19,7 @@ import org.apache.hc.client5.http.impl.async.HttpAsyncClients; import org.apache.hc.core5.concurrent.FutureCallback; import org.apache.hc.core5.http.HttpResponse; +import org.apache.hc.core5.http.protocol.HttpContext; import org.apache.hc.core5.http2.HttpVersionPolicy; import org.apache.hc.core5.io.CloseMode; import org.junit.jupiter.api.AfterAll; @@ -72,6 +73,19 @@ SimpleHttpRequest createRequest(String method, URI uri) { } } + @Nested + class ApacheClientNullContextTest extends AbstractTest { + @Override + SimpleHttpRequest createRequest(String method, URI uri) { + return new SimpleHttpRequest(method, uri); + } + + @Override + protected HttpContext getContext() { + return null; + } + } + abstract class AbstractTest extends AbstractApacheHttpClientTest { @Override protected SimpleHttpRequest buildRequest(String method, URI uri, Map headers) { @@ -88,12 +102,12 @@ protected SimpleHttpRequest buildRequest(String method, URI uri, Map