From 6d254b3ad1ec5907ec126c278fa03089f01fa6ea Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Mon, 13 Dec 2021 09:25:48 -0800 Subject: [PATCH] Additional http.status_code assertion (#4872) --- .../testing/junit/http/AbstractHttpClientTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java index 113bbbceff48..98f3165fe121 100644 --- a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java +++ b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java @@ -969,6 +969,9 @@ SpanDataAssert assertClientSpan( if (responseCode != null) { assertThat(attrs) .containsEntry(SemanticAttributes.HTTP_STATUS_CODE, (long) responseCode); + } else { + // worth adding AttributesAssert.doesNotContainKey? + assertThat(attrs.get(SemanticAttributes.HTTP_STATUS_CODE)).isNull(); } }); }