|
36 | 36 | import io.opentelemetry.api.trace.SpanKind;
|
37 | 37 | import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
|
38 | 38 | import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
|
| 39 | +import io.opentelemetry.sdk.testing.assertj.EventDataAssert; |
39 | 40 | import io.opentelemetry.sdk.testing.assertj.TraceAssert;
|
40 | 41 | import io.opentelemetry.sdk.trace.data.StatusData;
|
41 | 42 | import io.opentelemetry.testing.internal.armeria.client.WebClient;
|
@@ -484,28 +485,33 @@ void get404Test() {
|
484 | 485 | .hasKind(SpanKind.INTERNAL)
|
485 | 486 | .hasParent(trace.getSpan(0))
|
486 | 487 | .hasStatus(StatusData.error())
|
487 |
| - .hasEventsSatisfyingExactly( |
488 |
| - event -> |
489 |
| - event |
490 |
| - .hasName(EXCEPTION_EVENT_NAME) |
491 |
| - .hasAttributesSatisfyingExactly( |
492 |
| - equalTo( |
493 |
| - EXCEPTION_TYPE, |
494 |
| - "org.springframework.web.server.ResponseStatusException"), |
495 |
| - satisfies( |
496 |
| - EXCEPTION_MESSAGE, |
497 |
| - val -> |
498 |
| - val.containsAnyOf( |
499 |
| - "Response status 404", "404 NOT_FOUND")), |
500 |
| - satisfies( |
501 |
| - EXCEPTION_STACKTRACE, |
502 |
| - val -> val.isInstanceOf(String.class)))) |
| 488 | + .hasEventsSatisfyingExactly(SpringWebfluxTest::resource404Exception) |
503 | 489 | .hasAttributesSatisfyingExactly(
|
504 | 490 | equalTo(
|
505 | 491 | stringKey("spring-webflux.handler.type"),
|
506 | 492 | "org.springframework.web.reactive.resource.ResourceWebHandler"))));
|
507 | 493 | }
|
508 | 494 |
|
| 495 | + private static void resource404Exception(EventDataAssert event) { |
| 496 | + if (Boolean.getBoolean("testLatestDeps")) { |
| 497 | + event |
| 498 | + .hasName(EXCEPTION_EVENT_NAME) |
| 499 | + .hasAttributesSatisfyingExactly( |
| 500 | + equalTo( |
| 501 | + EXCEPTION_TYPE, |
| 502 | + "org.springframework.web.reactive.resource.NoResourceFoundException"), |
| 503 | + satisfies(EXCEPTION_MESSAGE, val -> val.isInstanceOf(String.class)), |
| 504 | + satisfies(EXCEPTION_STACKTRACE, val -> val.isInstanceOf(String.class))); |
| 505 | + } else { |
| 506 | + event |
| 507 | + .hasName(EXCEPTION_EVENT_NAME) |
| 508 | + .hasAttributesSatisfyingExactly( |
| 509 | + equalTo(EXCEPTION_TYPE, "org.springframework.web.server.ResponseStatusException"), |
| 510 | + equalTo(EXCEPTION_MESSAGE, "Response status 404"), |
| 511 | + satisfies(EXCEPTION_STACKTRACE, val -> val.isInstanceOf(String.class))); |
| 512 | + } |
| 513 | + } |
| 514 | + |
509 | 515 | @Test
|
510 | 516 | void basicPostTest() {
|
511 | 517 | String echoString = "TEST";
|
|
0 commit comments