77
88import static io .opentelemetry .api .common .AttributeKey .booleanKey ;
99import static io .opentelemetry .sdk .testing .assertj .OpenTelemetryAssertions .equalTo ;
10- import static io .opentelemetry .semconv .incubating .CodeIncubatingAttributes .CODE_FUNCTION ;
11- import static io .opentelemetry .semconv .incubating .CodeIncubatingAttributes .CODE_NAMESPACE ;
10+ import static io .opentelemetry .semconv .incubating .CodeIncubatingAttributes .CODE_FUNCTION_NAME ;
1211import static org .assertj .core .api .Assertions .assertThat ;
1312import static org .assertj .core .api .Assertions .catchThrowable ;
1413
1918import org .junit .jupiter .api .Test ;
2019import org .junit .jupiter .api .extension .RegisterExtension ;
2120
22- @ SuppressWarnings ("deprecation" ) // CodeIncubatingAttributes.CODE_FUNCTION is deprecated
2321public abstract class AbstractWithSpanTest <T extends U , U > {
2422
2523 @ RegisterExtension
@@ -59,8 +57,9 @@ void success() {
5957 .hasKind (SpanKind .INTERNAL )
6058 .hasNoParent ()
6159 .hasAttributesSatisfyingExactly (
62- equalTo (CODE_NAMESPACE , traced .getClass ().getName ()),
63- equalTo (CODE_FUNCTION , "completable" ))));
60+ equalTo (
61+ CODE_FUNCTION_NAME ,
62+ traced .getClass ().getCanonicalName () + ".completable" ))));
6463 }
6564
6665 @ Test
@@ -82,8 +81,7 @@ void failure() {
8281 .hasStatus (StatusData .error ())
8382 .hasException (AbstractTraced .FAILURE )
8483 .hasAttributesSatisfyingExactly (
85- equalTo (CODE_NAMESPACE , traced .getClass ().getName ()),
86- equalTo (CODE_FUNCTION , "completable" ))));
84+ equalTo (CODE_FUNCTION_NAME , traced .getClass ().getName ()+".completable" ))));
8785 }
8886
8987 @ Test
@@ -100,8 +98,7 @@ void canceled() {
10098 .hasKind (SpanKind .INTERNAL )
10199 .hasNoParent ()
102100 .hasAttributesSatisfyingExactly (
103- equalTo (CODE_NAMESPACE , traced .getClass ().getName ()),
104- equalTo (CODE_FUNCTION , "completable" ),
101+ equalTo (CODE_FUNCTION_NAME , traced .getClass ().getName ()+".completable" ),
105102 equalTo (booleanKey (canceledKey ()), true ))));
106103 }
107104
@@ -118,8 +115,7 @@ void immediateSuccess() {
118115 .hasKind (SpanKind .INTERNAL )
119116 .hasNoParent ()
120117 .hasAttributesSatisfyingExactly (
121- equalTo (CODE_NAMESPACE , traced .getClass ().getName ()),
122- equalTo (CODE_FUNCTION , "alreadySucceeded" ))));
118+ equalTo (CODE_FUNCTION_NAME , traced .getClass ().getName ()+".alreadySucceeded" ))));
123119 }
124120
125121 @ Test
@@ -138,7 +134,6 @@ void immediateFailure() {
138134 .hasStatus (StatusData .error ())
139135 .hasException (AbstractTraced .FAILURE )
140136 .hasAttributesSatisfyingExactly (
141- equalTo (CODE_NAMESPACE , traced .getClass ().getName ()),
142- equalTo (CODE_FUNCTION , "alreadyFailed" ))));
137+ equalTo (CODE_FUNCTION_NAME , traced .getClass ().getName ()+".alreadyFailed" ))));
143138 }
144139}
0 commit comments