Skip to content

Commit bd34f39

Browse files
authored
Review fixes for jdbc:library (#18062)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
1 parent 71bbdc6 commit bd34f39

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

instrumentation/jdbc/library/src/test/java/io/opentelemetry/instrumentation/jdbc/OpenTelemetryDriverTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ private static boolean hasTestDriver() {
268268
@Test
269269
void verifyGetPropertyInfoWithNullUrl() {
270270
assertThatThrownBy(() -> OpenTelemetryDriver.INSTANCE.getPropertyInfo(null, null))
271-
.describedAs("url is required")
272-
.isInstanceOf(IllegalArgumentException.class);
271+
.isInstanceOf(IllegalArgumentException.class)
272+
.hasMessage("url is required");
273273
}
274274

275275
@DisplayName("verify get property info with empty url")

instrumentation/jdbc/library/src/test/java/io/opentelemetry/instrumentation/jdbc/internal/OpenTelemetryConnectionTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import io.opentelemetry.instrumentation.jdbc.internal.dbinfo.DbInfo;
1818
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
1919
import io.opentelemetry.instrumentation.testing.junit.LibraryInstrumentationExtension;
20+
import java.sql.SQLException;
2021
import java.sql.Statement;
2122
import java.util.ArrayList;
2223
import java.util.List;
@@ -38,7 +39,7 @@ void resetTest() {
3839

3940
@SuppressWarnings("unchecked")
4041
@Test
41-
void testVerifyCreateStatementReturnsOtelWrapper() throws Exception {
42+
void testVerifyCreateStatementReturnsOtelWrapper() throws SQLException {
4243
OpenTelemetry openTelemetry = OpenTelemetry.propagating(ContextPropagators.noop());
4344
OpenTelemetryConnection connection = getConnection(openTelemetry);
4445

@@ -53,7 +54,7 @@ void testVerifyCreateStatementReturnsOtelWrapper() throws Exception {
5354

5455
@SuppressWarnings("unchecked")
5556
@Test
56-
void testVerifyPrepareStatementReturnsOtelWrapper() throws Exception {
57+
void testVerifyPrepareStatementReturnsOtelWrapper() throws SQLException {
5758
OpenTelemetry openTelemetry = OpenTelemetry.propagating(ContextPropagators.noop());
5859
OpenTelemetryConnection connection = getConnection(openTelemetry);
5960

@@ -80,7 +81,7 @@ void testVerifyPrepareStatementReturnsOtelWrapper() throws Exception {
8081

8182
@SuppressWarnings("unchecked")
8283
@Test
83-
void testVerifyPrepareCallReturnsOtelWrapper() throws Exception {
84+
void testVerifyPrepareCallReturnsOtelWrapper() throws SQLException {
8485
OpenTelemetry openTelemetry = OpenTelemetry.propagating(ContextPropagators.noop());
8586
OpenTelemetryConnection connection = getConnection(openTelemetry);
8687

instrumentation/jdbc/library/src/test/java/io/opentelemetry/instrumentation/jdbc/internal/WrapperTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class WrapperTest {
2323
// we don't implement methods introduced in jdbc 4.5 (added in java 26) yet
2424
@EnabledForJreRange(max = JRE.JAVA_25)
2525
@Test
26-
void wrapperImplementsAllMethods() throws Exception {
26+
void wrapperImplementsAllMethods() throws NoSuchMethodException {
2727
validate(Statement.class, OpenTelemetryStatement.class);
2828
validate(PreparedStatement.class, OpenTelemetryPreparedStatement.class);
2929
validate(CallableStatement.class, OpenTelemetryCallableStatement.class);
@@ -35,7 +35,7 @@ void wrapperImplementsAllMethods() throws Exception {
3535
validate(ResultSet.class, OpenTelemetryResultSet.class);
3636
}
3737

38-
void validate(Class<?> jdbcClass, Class<?> wrapperClass) throws Exception {
38+
void validate(Class<?> jdbcClass, Class<?> wrapperClass) throws NoSuchMethodException {
3939
for (Method method : jdbcClass.getMethods()) {
4040
Method result = wrapperClass.getMethod(method.getName(), method.getParameterTypes());
4141
if (!result.getDeclaringClass().getName().startsWith("io.opentelemetry")) {

0 commit comments

Comments
 (0)