xtern commented on code in PR #2616:
URL: https://github.com/apache/ignite-3/pull/2616#discussion_r1336225897
##########
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());
+ }
+ });
Review Comment:
```suggestion
() -> stmt.executeQuery("select * from PUBLIC.Org where name
= 2")
);
```
##########
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:
```suggestion
() -> stmt.executeQuery("select * from PUBLIC.Person where
name = 2")
);
```
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/jdbc/ItJdbcTest.java:
##########
@@ -98,7 +97,7 @@ void tearDown() {
@DisplayName("Jdbc client can not connect without basic authentication
configured")
void jdbcCanNotConnectWithoutBasicAuthentication() {
var url = "jdbc:ignite:thin://127.0.0.1:10800";
- assertThrows(SQLException.class, () ->
DriverManager.getConnection(url));
+ JdbcTestUtils.assertThrowsSqlException(SQLException.class, () ->
DriverManager.getConnection(url));
Review Comment:
assertThrows**SqlException**(**SQLException**.class sounds strange
##########
modules/core/src/main/java/org/apache/ignite/lang/IgniteExceptionMapperUtil.java:
##########
@@ -137,4 +140,22 @@ public static <T> CompletableFuture<T>
convertToPublicFuture(CompletableFuture<T
private static <T extends Exception, R extends Exception> Exception
map(IgniteExceptionMapper<T, R> mapper, Throwable t) {
return mapper.map(mapper.mappingFrom().cast(t));
}
+
+ /**
+ * Assert that passed exception is not related to internal exceptions.
+ *
+ * @param ex Exception to be checked.
+ * @return {@code true} if canonical name of passed Exception doesn't
contains word 'internal'.
+ * @throws AssertionError in case assertions is enabled and passed
exception is fail check.
+ */
+ public static boolean assertInternal(Throwable ex) {
Review Comment:
I suggest keep this change for IGNITE-20348 and not adding it in this PR.
* Method name is confusing - may be it should be something like
`assertPublic` or at least the return value should be inverted.
* Assertion inside another assertion also seems strange to me.
* This check looks more like a part of the static analysis :thinking:
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlAsynchronousApiTest.java:
##########
@@ -345,14 +344,17 @@ public void checkTransactionsWithDml() {
outerTx.commit();
// Outdated tx.
- Transaction outerTx0 = outerTx;
- IgniteException e = assertThrows(IgniteException.class,
Review Comment:
The test check seems to be working, why do we need to disable it right now?
Maybe just add a TODO to rework it?
--
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]