@@ -336,8 +336,6 @@ static Stream<Arguments> basicStatementStream() throws SQLException {
336336 "INFORMATION_SCHEMA.SYSTEM_USERS" ));
337337 }
338338
339- @ DisplayName (
340- "basic statement with #connection.getClass().getCanonicalName() on #system generates spans" )
341339 @ ParameterizedTest
342340 @ MethodSource ("basicStatementStream" )
343341 public void testBasicStatement (
@@ -370,10 +368,11 @@ public void testBasicStatement(
370368 equalTo (DbIncubatingAttributes .DB_NAME , dbNameLower ),
371369 satisfies (
372370 DbIncubatingAttributes .DB_USER ,
373- val ->
374- val .satisfiesAnyOf (
375- v -> assertThat (v ).isEqualTo (username ),
376- v -> assertThat (v ).isNull ())),
371+ val -> {
372+ if (username != null ) {
373+ val .isEqualTo (username );
374+ }
375+ }),
377376 equalTo (DB_CONNECTION_STRING , url ),
378377 equalTo (DbIncubatingAttributes .DB_STATEMENT , sanitizedQuery ),
379378 equalTo (DbIncubatingAttributes .DB_OPERATION , "SELECT" ),
@@ -458,8 +457,6 @@ static Stream<Arguments> preparedStatementStream() throws SQLException {
458457
459458 @ ParameterizedTest
460459 @ MethodSource ("preparedStatementStream" )
461- @ DisplayName (
462- "prepared statement execute on #system with #connection.getClass().getCanonicalName() generates a span" )
463460 void testPreparedStatementExecute (
464461 String system ,
465462 Connection connection ,
@@ -472,7 +469,6 @@ void testPreparedStatementExecute(
472469 throws SQLException {
473470 PreparedStatement statement = connection .prepareStatement (query );
474471 cleanup .deferCleanup (statement );
475- cleanup .deferCleanup (connection );
476472 ResultSet resultSet =
477473 testing .runWithSpan (
478474 "parent" ,
@@ -497,10 +493,11 @@ void testPreparedStatementExecute(
497493 equalTo (DbIncubatingAttributes .DB_NAME , dbNameLower ),
498494 satisfies (
499495 DbIncubatingAttributes .DB_USER ,
500- val ->
501- val .satisfiesAnyOf (
502- v -> assertThat (v ).isEqualTo (username ),
503- v -> assertThat (v ).isNull ())),
496+ val -> {
497+ if (username != null ) {
498+ val .isEqualTo (username );
499+ }
500+ }),
504501 equalTo (DB_CONNECTION_STRING , url ),
505502 equalTo (DbIncubatingAttributes .DB_STATEMENT , sanitizedQuery ),
506503 equalTo (DbIncubatingAttributes .DB_OPERATION , "SELECT" ),
@@ -509,8 +506,6 @@ void testPreparedStatementExecute(
509506
510507 @ ParameterizedTest
511508 @ MethodSource ("preparedStatementStream" )
512- @ DisplayName (
513- "prepared statement query on #system with #connection.getClass().getCanonicalName() generates a span" )
514509 void testPreparedStatementQuery (
515510 String system ,
516511 Connection connection ,
@@ -523,7 +518,6 @@ void testPreparedStatementQuery(
523518 throws SQLException {
524519 PreparedStatement statement = connection .prepareStatement (query );
525520 cleanup .deferCleanup (statement );
526- cleanup .deferCleanup (connection );
527521 ResultSet resultSet = testing .runWithSpan ("parent" , () -> statement .executeQuery ());
528522
529523 resultSet .next ();
@@ -542,10 +536,11 @@ void testPreparedStatementQuery(
542536 equalTo (DbIncubatingAttributes .DB_NAME , dbNameLower ),
543537 satisfies (
544538 DbIncubatingAttributes .DB_USER ,
545- val ->
546- val .satisfiesAnyOf (
547- v -> assertThat (v ).isEqualTo (username ),
548- v -> assertThat (v ).isNull ())),
539+ val -> {
540+ if (username != null ) {
541+ val .isEqualTo (username );
542+ }
543+ }),
549544 equalTo (DB_CONNECTION_STRING , url ),
550545 equalTo (DbIncubatingAttributes .DB_STATEMENT , sanitizedQuery ),
551546 equalTo (DbIncubatingAttributes .DB_OPERATION , "SELECT" ),
@@ -554,8 +549,6 @@ void testPreparedStatementQuery(
554549
555550 @ ParameterizedTest
556551 @ MethodSource ("preparedStatementStream" )
557- @ DisplayName (
558- "prepared call on #system with #connection.getClass().getCanonicalName() generates a span" )
559552 void testPreparedCall (
560553 String system ,
561554 Connection connection ,
@@ -568,7 +561,6 @@ void testPreparedCall(
568561 throws SQLException {
569562 CallableStatement statement = connection .prepareCall (query );
570563 cleanup .deferCleanup (statement );
571- cleanup .deferCleanup (connection );
572564 ResultSet resultSet = testing .runWithSpan ("parent" , () -> statement .executeQuery ());
573565
574566 resultSet .next ();
@@ -587,10 +579,11 @@ void testPreparedCall(
587579 equalTo (DbIncubatingAttributes .DB_NAME , dbNameLower ),
588580 satisfies (
589581 DbIncubatingAttributes .DB_USER ,
590- val ->
591- val .satisfiesAnyOf (
592- v -> assertThat (v ).isEqualTo (username ),
593- v -> assertThat (v ).isNull ())),
582+ val -> {
583+ if (username != null ) {
584+ val .isEqualTo (username );
585+ }
586+ }),
594587 equalTo (DB_CONNECTION_STRING , url ),
595588 equalTo (DbIncubatingAttributes .DB_STATEMENT , sanitizedQuery ),
596589 equalTo (DbIncubatingAttributes .DB_OPERATION , "SELECT" ),
@@ -699,8 +692,6 @@ static Stream<Arguments> statementUpdateStream() throws SQLException {
699692
700693 @ ParameterizedTest
701694 @ MethodSource ("statementUpdateStream" )
702- @ DisplayName (
703- "statement update on #system with #connection.getClass().getCanonicalName() generates a span" )
704695 void testStatementUpdate (
705696 String system ,
706697 Connection connection ,
@@ -712,7 +703,6 @@ void testStatementUpdate(
712703 throws SQLException {
713704 Statement statement = connection .createStatement ();
714705 cleanup .deferCleanup (statement );
715- cleanup .deferCleanup (connection );
716706 String sql = connection .nativeSQL (query );
717707 testing .runWithSpan ("parent" , () -> assertThat (statement .execute (sql )).isFalse ());
718708
@@ -731,10 +721,11 @@ void testStatementUpdate(
731721 equalTo (DbIncubatingAttributes .DB_NAME , dbNameLower ),
732722 satisfies (
733723 DbIncubatingAttributes .DB_USER ,
734- val ->
735- val .satisfiesAnyOf (
736- v -> assertThat (v ).isEqualTo (username ),
737- v -> assertThat (v ).isNull ())),
724+ val -> {
725+ if (username != null ) {
726+ val .isEqualTo (username );
727+ }
728+ }),
738729 equalTo (DB_CONNECTION_STRING , url ),
739730 equalTo (DbIncubatingAttributes .DB_STATEMENT , query ),
740731 equalTo (DbIncubatingAttributes .DB_OPERATION , "CREATE TABLE" ),
@@ -811,8 +802,6 @@ static Stream<Arguments> preparedStatementUpdateStream() throws SQLException {
811802
812803 @ ParameterizedTest
813804 @ MethodSource ("preparedStatementUpdateStream" )
814- @ DisplayName (
815- "prepared statement update on #system with #connection.getClass().getCanonicalName() generates a span" )
816805 void testPreparedStatementUpdate (
817806 String system ,
818807 Connection connection ,
@@ -825,7 +814,6 @@ void testPreparedStatementUpdate(
825814 String sql = connection .nativeSQL (query );
826815 PreparedStatement statement = connection .prepareStatement (sql );
827816 cleanup .deferCleanup (statement );
828- cleanup .deferCleanup (connection );
829817 testing .runWithSpan ("parent" , () -> assertThat (statement .executeUpdate ()).isEqualTo (0 ));
830818
831819 testing .waitAndAssertTraces (
@@ -903,8 +891,6 @@ static Stream<Arguments> connectionConstructorStream() {
903891 @ SuppressWarnings ("CatchingUnchecked" )
904892 @ ParameterizedTest
905893 @ MethodSource ("connectionConstructorStream" )
906- @ DisplayName (
907- "connection constructor throwing then generating correct spans after recovery using #driver connection (prepare statement = #prepareStatement)" )
908894 void testConnectionConstructorThrowing (
909895 boolean prepareStatement ,
910896 String system ,
@@ -992,8 +978,6 @@ static Stream<Arguments> getConnectionStream() {
992978
993979 @ ParameterizedTest (autoCloseArguments = false )
994980 @ MethodSource ("getConnectionStream" )
995- @ DisplayName (
996- "calling #datasource.class.simpleName getConnection generates a span when under existing trace" )
997981 void testGetConnection (
998982 DataSource datasource ,
999983 Consumer <DataSource > init ,
@@ -1033,10 +1017,11 @@ void testGetConnection(
10331017 equalTo (DbIncubatingAttributes .DB_SYSTEM , system ),
10341018 satisfies (
10351019 DbIncubatingAttributes .DB_USER ,
1036- val1 ->
1037- val1 .satisfiesAnyOf (
1038- v1 -> assertThat (v1 ).isEqualTo (user ),
1039- v1 -> assertThat (v1 ).isNull ())),
1020+ val -> {
1021+ if (user != null ) {
1022+ val .isEqualTo (user );
1023+ }
1024+ }),
10401025 equalTo (DbIncubatingAttributes .DB_NAME , "jdbcunittest" ),
10411026 equalTo (DB_CONNECTION_STRING , connectionString ))));
10421027 if (recursive ) {
@@ -1053,10 +1038,11 @@ void testGetConnection(
10531038 equalTo (DbIncubatingAttributes .DB_SYSTEM , system ),
10541039 satisfies (
10551040 DbIncubatingAttributes .DB_USER ,
1056- val ->
1057- val .satisfiesAnyOf (
1058- v -> assertThat (v ).isEqualTo (user ),
1059- v -> assertThat (v ).isNull ())),
1041+ val -> {
1042+ if (user != null ) {
1043+ val .isEqualTo (user );
1044+ }
1045+ }),
10601046 equalTo (DbIncubatingAttributes .DB_NAME , "jdbcunittest" ),
10611047 equalTo (DB_CONNECTION_STRING , connectionString )));
10621048 }
@@ -1142,7 +1128,6 @@ static Stream<Arguments> spanNameStream() {
11421128 }
11431129
11441130 @ ParameterizedTest
1145- @ DisplayName ("should produce proper span name #spanName" )
11461131 @ MethodSource ("spanNameStream" )
11471132 void testProduceProperSpanName (
11481133 String url ,
@@ -1184,7 +1169,6 @@ void testProduceProperSpanName(
11841169
11851170 @ ParameterizedTest
11861171 @ ValueSource (strings = {"hikari" , "tomcat" , "c3p0" })
1187- @ DisplayName ("#connectionPoolName connections should be cached in case of wrapped connections" )
11881172 void testConnectionCached (String connectionPoolName ) throws SQLException {
11891173 String dbType = "hsqldb" ;
11901174 DataSource ds = createDs (connectionPoolName , dbType , jdbcUrls .get (dbType ));
@@ -1272,7 +1256,6 @@ static Stream<Arguments> recursiveStatementsStream() {
12721256 // regression test for
12731257 // https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/2644
12741258 @ ParameterizedTest
1275- @ DisplayName ("should handle recursive Statements inside Connection.getMetaData(): #desc" )
12761259 @ MethodSource ("recursiveStatementsStream" )
12771260 void testHandleRecursiveStatements (
12781261 String desc ,
0 commit comments