From e4548dbd48cec82b0116e4449236fac849f4295e Mon Sep 17 00:00:00 2001 From: Jay DeLuca Date: Fri, 1 Nov 2024 08:43:33 -0400 Subject: [PATCH] update exception assert --- .../instrumentation/dropwizard/DropwizardAsyncTest.java | 1 - .../instrumentation/dropwizard/DropwizardTest.java | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/instrumentation/dropwizard/dropwizard-testing/src/test/java/io/opentelemetry/javaagent/instrumentation/dropwizard/DropwizardAsyncTest.java b/instrumentation/dropwizard/dropwizard-testing/src/test/java/io/opentelemetry/javaagent/instrumentation/dropwizard/DropwizardAsyncTest.java index ffc43792ffd4..c94fcb84ba6e 100644 --- a/instrumentation/dropwizard/dropwizard-testing/src/test/java/io/opentelemetry/javaagent/instrumentation/dropwizard/DropwizardAsyncTest.java +++ b/instrumentation/dropwizard/dropwizard-testing/src/test/java/io/opentelemetry/javaagent/instrumentation/dropwizard/DropwizardAsyncTest.java @@ -49,7 +49,6 @@ protected void configure(HttpServerTestOptions options) { super.configure(options); // server spans are ended inside the JAX-RS controller spans options.setVerifyServerSpanEndTime(false); - options.setExpectedException(new IllegalStateException(EXCEPTION.getBody())); } public static class AsyncTestApp extends Application { diff --git a/instrumentation/dropwizard/dropwizard-testing/src/test/java/io/opentelemetry/javaagent/instrumentation/dropwizard/DropwizardTest.java b/instrumentation/dropwizard/dropwizard-testing/src/test/java/io/opentelemetry/javaagent/instrumentation/dropwizard/DropwizardTest.java index 7a9704639adb..2a01f94d8fe7 100644 --- a/instrumentation/dropwizard/dropwizard-testing/src/test/java/io/opentelemetry/javaagent/instrumentation/dropwizard/DropwizardTest.java +++ b/instrumentation/dropwizard/dropwizard-testing/src/test/java/io/opentelemetry/javaagent/instrumentation/dropwizard/DropwizardTest.java @@ -76,6 +76,7 @@ protected void configure(HttpServerTestOptions options) { options.setHasResponseSpan(endpoint -> endpoint == NOT_FOUND); options.setTestPathParam(true); options.setResponseCodeOnNonStandardHttpMethod(405); + options.setExpectedException(new IllegalStateException(EXCEPTION.getBody())); options.setExpectedHttpRoute( (endpoint, method) -> { @@ -107,7 +108,8 @@ protected SpanDataAssert assertHandlerSpan( span.hasName(testResource().getSimpleName() + "." + getEndpointName(endpoint)) .hasKind(INTERNAL); if (EXCEPTION.equals(endpoint)) { - span.hasStatus(StatusData.error()).hasException(new Exception(EXCEPTION.getBody())); + span.hasStatus(StatusData.error()) + .hasException(new IllegalStateException(EXCEPTION.getBody())); } return span; } @@ -192,7 +194,7 @@ public Response exception() throws Exception { return controller( EXCEPTION, () -> { - throw new Exception(EXCEPTION.getBody()); + throw new IllegalStateException(EXCEPTION.getBody()); }); }