1717import static io .opentelemetry .semconv .incubating .DbIncubatingAttributes .DB_SQL_TABLE ;
1818import static io .opentelemetry .semconv .incubating .DbIncubatingAttributes .DB_STATEMENT ;
1919import static io .opentelemetry .semconv .incubating .DbIncubatingAttributes .DB_SYSTEM ;
20+ import static io .opentelemetry .semconv .incubating .DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ;
2021import static java .util .Arrays .asList ;
2122import static org .assertj .core .api .Assertions .assertThat ;
22- import static org .junit .jupiter .api .Assertions .assertFalse ;
23- import static org .junit .jupiter .api .Assertions .assertNull ;
2423
25- import io .opentelemetry .api .common .AttributeKey ;
2624import io .opentelemetry .api .common .Attributes ;
2725import io .opentelemetry .instrumentation .testing .junit .AgentInstrumentationExtension ;
2826import io .opentelemetry .instrumentation .testing .junit .InstrumentationExtension ;
@@ -55,11 +53,11 @@ static void tearDown() {
5553
5654 @ SuppressWarnings ("deprecation" ) // DbIncubatingAttributes.DB_NAME has been deprecated
5755 @ Test
58- void testCurd () {
56+ void testCrud () {
5957 Customer customer = new Customer ("Bob" , "Anonymous" );
6058
61- assertNull (customer .getId ());
62- assertFalse (testing .runWithSpan ("parent" , () -> repo .findAll ().iterator ().hasNext ()));
59+ assertThat (customer .getId ()). isNull ( );
60+ assertThat (testing .runWithSpan ("parent" , () -> repo .findAll ().iterator ().hasNext ())). isFalse ( );
6361
6462 testing .waitAndAssertTraces (
6563 trace ->
@@ -75,15 +73,14 @@ void testCurd() {
7573 .hasParent (trace .getSpan (0 ))
7674 .hasAttributesSatisfyingExactly (
7775 satisfies (
78- AttributeKey . stringKey ("hibernate.session_id" ),
76+ stringKey ("hibernate.session_id" ),
7977 val -> val .isInstanceOf (String .class ))),
8078 span ->
8179 span .hasName ("SELECT test.Customer" )
8280 .hasKind (CLIENT )
8381 .hasParent (trace .getSpan (1 ))
8482 .hasAttributesSatisfyingExactly (
85- equalTo (
86- DB_SYSTEM , DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
83+ equalTo (DB_SYSTEM , HSQLDB ),
8784 equalTo (maybeStable (DB_NAME ), "test" ),
8885 equalTo (
8986 DbIncubatingAttributes .DB_USER ,
@@ -104,7 +101,7 @@ void testCurd() {
104101 .hasParent (trace .getSpan (0 ))
105102 .hasAttributesSatisfyingExactly (
106103 equalTo (
107- AttributeKey . stringKey ("hibernate.session_id" ),
104+ stringKey ("hibernate.session_id" ),
108105 trace
109106 .getSpan (1 )
110107 .getAttributes ()
@@ -130,15 +127,14 @@ void testCurd() {
130127 .hasParent (trace .getSpan (0 ))
131128 .hasAttributesSatisfyingExactly (
132129 satisfies (
133- AttributeKey . stringKey ("hibernate.session_id" ),
130+ stringKey ("hibernate.session_id" ),
134131 val -> val .isInstanceOf (String .class ))),
135132 span ->
136133 span .hasName ("CALL test" )
137134 .hasKind (CLIENT )
138135 .hasParent (trace .getSpan (1 ))
139136 .hasAttributesSatisfyingExactly (
140- equalTo (
141- DB_SYSTEM , DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
137+ equalTo (DB_SYSTEM , HSQLDB ),
142138 equalTo (maybeStable (DB_NAME ), "test" ),
143139 equalTo (
144140 DbIncubatingAttributes .DB_USER ,
@@ -154,7 +150,7 @@ void testCurd() {
154150 .hasParent (trace .getSpan (0 ))
155151 .hasAttributesSatisfyingExactly (
156152 equalTo (
157- AttributeKey . stringKey ("hibernate.session_id" ),
153+ stringKey ("hibernate.session_id" ),
158154 trace
159155 .getSpan (1 )
160156 .getAttributes ()
@@ -164,8 +160,7 @@ void testCurd() {
164160 .hasKind (CLIENT )
165161 .hasParent (trace .getSpan (3 ))
166162 .hasAttributesSatisfyingExactly (
167- equalTo (
168- DB_SYSTEM , DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
163+ equalTo (DB_SYSTEM , HSQLDB ),
169164 equalTo (maybeStable (DB_NAME ), "test" ),
170165 equalTo (
171166 DbIncubatingAttributes .DB_USER ,
@@ -200,14 +195,13 @@ void testCurd() {
200195 .hasParent (trace .getSpan (0 ))
201196 .hasAttributesSatisfyingExactly (
202197 satisfies (
203- AttributeKey . stringKey ("hibernate.session_id" ),
198+ stringKey ("hibernate.session_id" ),
204199 val -> val .isInstanceOf (String .class ))),
205200 span ->
206201 span .hasName ("SELECT test.Customer" )
207202 .hasKind (CLIENT )
208203 .hasAttributesSatisfyingExactly (
209- equalTo (
210- DB_SYSTEM , DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
204+ equalTo (DB_SYSTEM , HSQLDB ),
211205 equalTo (maybeStable (DB_NAME ), "test" ),
212206 equalTo (
213207 DbIncubatingAttributes .DB_USER ,
@@ -228,7 +222,7 @@ void testCurd() {
228222 .hasParent (trace .getSpan (0 ))
229223 .hasAttributesSatisfyingExactly (
230224 equalTo (
231- AttributeKey . stringKey ("hibernate.session_id" ),
225+ stringKey ("hibernate.session_id" ),
232226 trace
233227 .getSpan (1 )
234228 .getAttributes ()
@@ -237,8 +231,7 @@ void testCurd() {
237231 span .hasName ("UPDATE test.Customer" )
238232 .hasKind (CLIENT )
239233 .hasAttributesSatisfyingExactly (
240- equalTo (
241- DB_SYSTEM , DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
234+ equalTo (DB_SYSTEM , HSQLDB ),
242235 equalTo (maybeStable (DB_NAME ), "test" ),
243236 equalTo (
244237 DbIncubatingAttributes .DB_USER ,
@@ -276,15 +269,14 @@ void testCurd() {
276269 .hasParent (trace .getSpan (0 ))
277270 .hasAttributesSatisfyingExactly (
278271 satisfies (
279- AttributeKey . stringKey ("hibernate.session_id" ),
272+ stringKey ("hibernate.session_id" ),
280273 val -> val .isInstanceOf (String .class ))),
281274 span ->
282275 span .hasName ("SELECT test.Customer" )
283276 .hasKind (CLIENT )
284277 .hasParent (trace .getSpan (1 ))
285278 .hasAttributesSatisfyingExactly (
286- equalTo (
287- DB_SYSTEM , DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
279+ equalTo (DB_SYSTEM , HSQLDB ),
288280 equalTo (maybeStable (DB_NAME ), "test" ),
289281 equalTo (
290282 DbIncubatingAttributes .DB_USER ,
@@ -320,15 +312,14 @@ void testCurd() {
320312 .hasParent (trace .getSpan (0 ))
321313 .hasAttributesSatisfyingExactly (
322314 satisfies (
323- AttributeKey . stringKey ("hibernate.session_id" ),
315+ stringKey ("hibernate.session_id" ),
324316 val -> val .isInstanceOf (String .class ))),
325317 span ->
326318 span .hasName ("SELECT test.Customer" )
327319 .hasKind (CLIENT )
328320 .hasParent (trace .getSpan (1 ))
329321 .hasAttributesSatisfyingExactly (
330- equalTo (
331- DB_SYSTEM , DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
322+ equalTo (DB_SYSTEM , HSQLDB ),
332323 equalTo (maybeStable (DB_NAME ), "test" ),
333324 equalTo (
334325 DbIncubatingAttributes .DB_USER ,
@@ -349,30 +340,29 @@ void testCurd() {
349340 .hasParent (trace .getSpan (0 ))
350341 .hasAttributesSatisfyingExactly (
351342 satisfies (
352- AttributeKey . stringKey ("hibernate.session_id" ),
343+ stringKey ("hibernate.session_id" ),
353344 val -> val .isInstanceOf (String .class ))),
354345 span ->
355346 span .hasName ("Session.delete spring.jpa.Customer" )
356347 .hasKind (INTERNAL )
357348 .hasParent (trace .getSpan (0 ))
358349 .hasAttributesSatisfyingExactly (
359350 satisfies (
360- AttributeKey . stringKey ("hibernate.session_id" ),
351+ stringKey ("hibernate.session_id" ),
361352 val -> val .isInstanceOf (String .class ))),
362353 span ->
363354 span .hasName ("Transaction.commit" )
364355 .hasKind (INTERNAL )
365356 .hasParent (trace .getSpan (0 ))
366357 .hasAttributesSatisfyingExactly (
367358 satisfies (
368- AttributeKey . stringKey ("hibernate.session_id" ),
359+ stringKey ("hibernate.session_id" ),
369360 val -> val .isInstanceOf (String .class ))),
370361 span ->
371362 span .hasName ("DELETE test.Customer" )
372363 .hasKind (CLIENT )
373364 .hasAttributesSatisfyingExactly (
374- equalTo (
375- DB_SYSTEM , DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
365+ equalTo (DB_SYSTEM , HSQLDB ),
376366 equalTo (maybeStable (DB_NAME ), "test" ),
377367 equalTo (
378368 DbIncubatingAttributes .DB_USER ,
0 commit comments