xtern commented on code in PR #2616:
URL: https://github.com/apache/ignite-3/pull/2616#discussion_r1337169678


##########
modules/jdbc/src/integrationTest/java/org/apache/ignite/jdbc/ItJdbcComplexQuerySelfTest.java:
##########
@@ -209,21 +208,25 @@ public void testWrongArgumentType() throws Exception {
         }
 
         // Check non-indexed field.
-        assertThrows(SQLException.class, () -> {
-            try (ResultSet rs = stmt.executeQuery("select * from PUBLIC.Org 
where name = 2")) {
-                assertFalse(rs.next());
-            }
-        });
+        JdbcTestUtils.assertThrowsSqlException(
+                "For input string: \"B\"",
+                () -> {
+                    try (ResultSet rs = stmt.executeQuery("select * from 
PUBLIC.Org where name = 2")) {
+                        assertFalse(rs.next());
+                    }
+                });
 
         // Check indexed field.
         try (ResultSet rs = stmt.executeQuery("select * from PUBLIC.Person 
where name = '2'")) {
             assertFalse(rs.next());
         }
 
-        assertThrows(SQLException.class, () -> {
-            try (ResultSet rs = stmt.executeQuery("select * from PUBLIC.Person 
where name = 2")) {
-                assertFalse(rs.next());
-            }
-        });
+        JdbcTestUtils.assertThrowsSqlException(
+                "For input string: \"Mike Green\"",
+                () -> {
+                    try (ResultSet rs = stmt.executeQuery("select * from 
PUBLIC.Person where name = 2")) {
+                        assertFalse(rs.next());
+                    }
+                });

Review Comment:
   You need to close `ResultSet` only if `executeQuery` does not throw 
exception (when this check fails), and I don't see any value from doing it here.
   Currently this code looks a bit confusing because because it’s not 
immediately clear which expression should throw an exception :thinking: .
   



##########
modules/jdbc/src/integrationTest/java/org/apache/ignite/jdbc/ItJdbcComplexQuerySelfTest.java:
##########
@@ -209,21 +208,25 @@ public void testWrongArgumentType() throws Exception {
         }
 
         // Check non-indexed field.
-        assertThrows(SQLException.class, () -> {
-            try (ResultSet rs = stmt.executeQuery("select * from PUBLIC.Org 
where name = 2")) {
-                assertFalse(rs.next());
-            }
-        });
+        JdbcTestUtils.assertThrowsSqlException(
+                "For input string: \"B\"",
+                () -> {
+                    try (ResultSet rs = stmt.executeQuery("select * from 
PUBLIC.Org where name = 2")) {
+                        assertFalse(rs.next());
+                    }
+                });
 
         // Check indexed field.
         try (ResultSet rs = stmt.executeQuery("select * from PUBLIC.Person 
where name = '2'")) {
             assertFalse(rs.next());
         }
 
-        assertThrows(SQLException.class, () -> {
-            try (ResultSet rs = stmt.executeQuery("select * from PUBLIC.Person 
where name = 2")) {
-                assertFalse(rs.next());
-            }
-        });
+        JdbcTestUtils.assertThrowsSqlException(
+                "For input string: \"Mike Green\"",
+                () -> {
+                    try (ResultSet rs = stmt.executeQuery("select * from 
PUBLIC.Person where name = 2")) {
+                        assertFalse(rs.next());
+                    }
+                });

Review Comment:
   You need to close `ResultSet` only if `executeQuery` does not throw 
exception (when this check fails), and I don't see any value from doing it here.
   Currently this code looks a bit confusing because because it’s not 
immediately clear which expression should throw an exception :thinking: .
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to