You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: vertx-db2-client/src/test/java/io/vertx/db2client/DB2ErrorMessageTest.java
+5-22Lines changed: 5 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -38,11 +38,10 @@ public void testConnectInvalidDatabase(TestContext ctx) {
38
38
"The SQL error message returned is not correct. It should have contained \"provided was not found\" or \"The connection was closed by the database server\", but instead it said \"" + ex.getMessage() + "\"");
"Wrong SQL state received. Expecting 2E000 or " + SQLState.AUTH_DATABASE_CONNECTION_REFUSED + ", but received " + ex.getSqlState());
46
45
}));
47
46
}
48
47
@@ -55,7 +54,6 @@ public void testConnectInvalidUsername(TestContext ctx) {
55
54
ctx.assertTrue(ex.getMessage().contains("Invalid credentials"), "The SQL error message returned is not correct. It should have contained \"Invalid credentials\", but instead it said \"" + ex.getMessage() + "\"");
@@ -68,23 +66,18 @@ public void testConnectInvalidPassword(TestContext ctx) {
68
66
ctx.assertTrue(ex.getMessage().contains("Invalid credentials"), "The SQL error message returned is not correct. It should have contained \"Invalid credentials\", but instead it said \"" + ex.getMessage() + "\"");
ctx.assertTrue(einstanceofDB2Exception, "Expected a DB2Exception to be thrown");
83
-
DB2Exceptionex = (DB2Exception) e;
77
+
} catch (DB2Exceptionex) {
84
78
ctx.assertTrue(ex.getMessage().contains("The database name cannot be blank or null"), "The SQL error message returned is not correct. It should have contained \"The database name cannot be blank or null\", but instead it said \"" + ex.getMessage() + "\"");
@@ -93,13 +86,10 @@ public void testQueryBlankUsername(TestContext ctx) {
93
86
try {
94
87
options.setUser("");
95
88
ctx.fail("Expected a DB2Exception to be thrown");
96
-
} catch (Exceptione) {
97
-
ctx.assertTrue(einstanceofDB2Exception, "Expected a DB2Exception to be thrown");
98
-
DB2Exceptionex = (DB2Exception) e;
89
+
} catch (DB2Exceptionex) {
99
90
ctx.assertTrue(ex.getMessage().contains("The user cannot be blank or null"), "The SQL error message returned is not correct. It should have contained \"The user cannot be blank or null\", but instead it said \"" + ex.getMessage() + "\"");
@@ -108,13 +98,10 @@ public void testQueryBlankPassword(TestContext ctx) {
108
98
try {
109
99
options.setPassword("");
110
100
ctx.fail("Expected a DB2Exception to be thrown");
111
-
} catch (Exceptione) {
112
-
ctx.assertTrue(einstanceofDB2Exception, "Expected a DB2Exception to be thrown");
113
-
DB2Exceptionex = (DB2Exception) e;
101
+
} catch (DB2Exceptionex) {
114
102
ctx.assertTrue(ex.getMessage().contains("The password cannot be blank or null"), "The SQL error message returned is not correct. It should have contained \"The password cannot be blank or null\", but instead it said \"" + ex.getMessage() + "\"");
@@ -128,7 +115,6 @@ public void testQueryBlankTable(TestContext ctx) {
128
115
ctx.assertTrue(ex.getMessage().contains("The SQL syntax provided was invalid"), "The SQL error message returned is not correct. It should have contained \"The SQL syntax provided was invalid\", but instead it said \"" + ex.getMessage() + "\"");
@@ -143,7 +129,6 @@ public void testInvalidTableQuery(TestContext ctx) {
143
129
ctx.assertTrue(ex.getMessage().contains("provided is not defined"), "The SQL error message returned is not correct. It should have contained \"provided is not defined\", but instead it said \"" + ex.getMessage() + "\"");
@@ -158,7 +143,6 @@ public void testInvalidColumnQuery(TestContext ctx) {
158
143
ctx.assertTrue(ex.getMessage().contains("provided does not exist"), "The SQL error message returned is not correct. It should have contained \"provided does not exist\", but instead it said \"" + ex.getMessage() + "\"");
@@ -173,7 +157,6 @@ public void testInvalidQuery(TestContext ctx) {
173
157
ctx.assertTrue(ex.getMessage().contains("The SQL syntax provided was invalid"), "The SQL error message returned is not correct. It should have contained \"The SQL syntax provided was invalid\", but instead it said \"" + ex.getMessage() + "\"");
0 commit comments