File tree Expand file tree Collapse file tree 3 files changed +12
-13
lines changed
instrumentation/jdbc/testing/src/main/java/io/opentelemetry/instrumentation/jdbc Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Original file line number Diff line number Diff line change 3030public class TestConnection implements Connection {
3131
3232 private final String url ;
33- Consumer <String > sqlConsumer = unused -> {} ;
33+ private final Consumer <String > sqlConsumer ;
3434
35- public TestConnection () {}
35+ public TestConnection () {
36+ this (null , unused -> {});
37+ }
3638
3739 public TestConnection (String url ) {
38- this . url = url ;
40+ this ( url , unused -> {}) ;
3941 }
4042
4143 public TestConnection (Consumer <String > sqlConsumer ) {
42- this . sqlConsumer = sqlConsumer ;
44+ this ( null , sqlConsumer ) ;
4345 }
4446
4547 public TestConnection (boolean throwException ) {
48+ this (null , unused -> {});
4649 if (throwException ) {
4750 throw new IllegalStateException ("connection exception" );
4851 }
4952 }
5053
51- public TestConnection (String url , boolean throwException ) {
52- this (throwException );
54+ private TestConnection (String url , Consumer <String > sqlConsumer ) {
5355 this .url = url ;
56+ this .sqlConsumer = sqlConsumer ;
5457 }
5558
5659 @ Override
Original file line number Diff line number Diff line change @@ -1125,7 +1125,7 @@ void testGetConnection(
11251125 @ DisplayName ("test getClientInfo exception" )
11261126 @ ValueSource (strings = "testing 123" )
11271127 void testGetClientInfoException (String query ) throws SQLException {
1128- TestConnection rawConnection = new TestConnection ("jdbc:testdb://localhost" , false );
1128+ TestConnection rawConnection = new TestConnection ("jdbc:testdb://localhost" );
11291129 Connection connection = wrap (rawConnection );
11301130 cleanup .deferCleanup (connection );
11311131
Original file line number Diff line number Diff line change 1010import java .sql .SQLException ;
1111
1212class DbCallingConnection extends TestConnection {
13- final boolean usePreparedStatement ;
14-
15- DbCallingConnection (boolean usePreparedStatement ) {
16- this (usePreparedStatement , null );
17- }
13+ private final boolean usePreparedStatement ;
1814
1915 DbCallingConnection (boolean usePreparedStatement , String url ) {
20- super (url , false );
16+ super (url );
2117 this .usePreparedStatement = usePreparedStatement ;
2218 }
2319
You can’t perform that action at this time.
0 commit comments