|
| 1 | +/* |
| 2 | + * Copyright The OpenTelemetry Authors |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + */ |
| 5 | + |
1 | 6 | package io.opentelemetry.javaagent.instrumentation.guava.v10_0; |
2 | 7 |
|
3 | 8 | import static org.assertj.core.api.Assertions.assertThat; |
@@ -28,27 +33,29 @@ class Listener { |
28 | 33 |
|
29 | 34 | @Subscribe |
30 | 35 | public void onEvent(String event) { |
31 | | - testing.runWithSpan("listener", () -> { |
32 | | - receivedTraceId = Span.current().getSpanContext().getTraceId(); |
33 | | - }); |
| 36 | + testing.runWithSpan( |
| 37 | + "listener", |
| 38 | + () -> { |
| 39 | + receivedTraceId = Span.current().getSpanContext().getTraceId(); |
| 40 | + }); |
34 | 41 | } |
35 | 42 | } |
36 | 43 |
|
37 | 44 | Listener listener = new Listener(); |
38 | 45 | asyncEventBus.register(listener); |
39 | 46 |
|
40 | 47 | String[] parentTraceId = new String[1]; |
41 | | - testing.runWithSpan("parent", () -> { |
42 | | - parentTraceId[0] = Span.current().getSpanContext().getTraceId(); |
43 | | - asyncEventBus.post("test"); |
44 | | - }); |
| 48 | + testing.runWithSpan( |
| 49 | + "parent", |
| 50 | + () -> { |
| 51 | + parentTraceId[0] = Span.current().getSpanContext().getTraceId(); |
| 52 | + asyncEventBus.post("test"); |
| 53 | + }); |
45 | 54 |
|
46 | 55 | testing.waitAndAssertTraces( |
47 | | - trace |
48 | | - -> trace.hasSpansSatisfyingExactly( |
49 | | - span -> span.hasName("parent"), |
50 | | - span -> span.hasName("listener") |
51 | | - )); |
| 56 | + trace -> |
| 57 | + trace.hasSpansSatisfyingExactly( |
| 58 | + span -> span.hasName("parent"), span -> span.hasName("listener"))); |
52 | 59 |
|
53 | 60 | assertThat(listener.receivedTraceId) |
54 | 61 | .isNotNull() |
|
0 commit comments