Skip to content

Commit dfad983

Browse files
committed
add spring api diff
1 parent 72bd860 commit dfad983

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

smoke-tests-otel-starter/spring-boot-3.2/src/test/java/io/opentelemetry/spring/smoketest/OtelSpringStarterSmokeTest.java

+13-15
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import io.opentelemetry.sdk.testing.assertj.TraceAssert;
1212
import io.opentelemetry.semconv.HttpAttributes;
1313
import io.opentelemetry.semconv.UrlAttributes;
14-
import java.util.function.Consumer;
1514
import org.junit.jupiter.api.Test;
1615
import org.springframework.beans.factory.annotation.Autowired;
1716
import org.springframework.boot.test.context.SpringBootTest;
@@ -45,23 +44,22 @@ void restClient() {
4544

4645
if (System.getProperty("org.graalvm.nativeimage.imagecode") != null) {
4746
// ignore the trace for creating the db table
48-
testing.waitAndAssertTraces(trace -> {}, assertClient());
47+
testing.waitAndAssertTraces(trace -> {}, OtelSpringStarterSmokeTest::assertClient);
4948
} else {
50-
testing.waitAndAssertTraces(assertClient());
49+
testing.waitAndAssertTraces(OtelSpringStarterSmokeTest::assertClient);
5150
}
5251
}
5352

54-
private static Consumer<TraceAssert> assertClient() {
55-
return traceAssert ->
56-
traceAssert.hasSpansSatisfyingExactly(
57-
nestedClientSpan ->
58-
nestedClientSpan
59-
.hasKind(SpanKind.CLIENT)
60-
.hasAttributesSatisfying(
61-
a -> assertThat(a.get(UrlAttributes.URL_FULL)).endsWith("/ping")),
62-
nestedServerSpan ->
63-
nestedServerSpan
64-
.hasKind(SpanKind.SERVER)
65-
.hasAttribute(HttpAttributes.HTTP_ROUTE, "/ping"));
53+
private static void assertClient(TraceAssert traceAssert) {
54+
traceAssert.hasSpansSatisfyingExactly(
55+
nestedClientSpan ->
56+
nestedClientSpan
57+
.hasKind(SpanKind.CLIENT)
58+
.hasAttributesSatisfying(
59+
a -> assertThat(a.get(UrlAttributes.URL_FULL)).endsWith("/ping")),
60+
nestedServerSpan ->
61+
nestedServerSpan
62+
.hasKind(SpanKind.SERVER)
63+
.hasAttribute(HttpAttributes.HTTP_ROUTE, "/ping"));
6664
}
6765
}

0 commit comments

Comments
 (0)