From 12dd3f7ecb47f02e3e71595755f1632b11d57a57 Mon Sep 17 00:00:00 2001 From: Cheena Malhotra Date: Fri, 26 Apr 2019 17:03:28 -0700 Subject: [PATCH] Review comments applied. --- .../com/microsoft/sqlserver/jdbc/TestResource.java | 2 -- .../jdbc/connection/ConnectionDriverTest.java | 12 ++++++++---- .../jdbc/databasemetadata/DatabaseMetaDataTest.java | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/TestResource.java b/src/test/java/com/microsoft/sqlserver/jdbc/TestResource.java index a81dbccec..638453043 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/TestResource.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/TestResource.java @@ -81,8 +81,6 @@ protected Object[][] getContents() { {"R_cannotOpenDatabase", "Cannot open database"}, {"R_shouldNotConnect", "Should not have connected"}, {"R_loginFailed", "Login failed"}, {"R_exitedMoreSeconds", "Exited in more than {0} seconds."}, {"R_exitedLessSeconds", "Exited in less than {0} seconds."}, - {"R_invalidArgumentExecutor", "The argument executor is not valid"}, - {"R_invalidArgumentCatalog", "The argument catalog is not valid"}, {"R_threadInterruptNotSet", "Thread's interrupt status is not set."}, {"R_connectMirrored", "Connecting to a mirrored"}, {"R_trustStorePasswordNotSet", "The DataSource trustStore password needs to be set."}, diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/connection/ConnectionDriverTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/connection/ConnectionDriverTest.java index 08844bf06..12cc2cc4b 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/connection/ConnectionDriverTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/connection/ConnectionDriverTest.java @@ -35,6 +35,7 @@ import com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource; import com.microsoft.sqlserver.jdbc.SQLServerDataSource; import com.microsoft.sqlserver.jdbc.TestResource; +import com.microsoft.sqlserver.jdbc.TestUtils; import com.microsoft.sqlserver.testframework.AbstractSQLGenerator; import com.microsoft.sqlserver.testframework.AbstractTest; import com.microsoft.sqlserver.testframework.Constants; @@ -80,7 +81,8 @@ public void testEncryptedConnection() throws SQLException { ds.setEncrypt(true); ds.setTrustServerCertificate(true); ds.setPacketSize(8192); - try (Connection con = ds.getConnection()) {} + try (Connection con = ds.getConnection()) { + } } @Test @@ -95,7 +97,8 @@ class MyEventListener implements javax.sql.ConnectionEventListener { boolean connClosed = false; boolean errorOccurred = false; - public MyEventListener() {} + public MyEventListener() { + } public void connectionClosed(ConnectionEvent event) { connClosed = true; @@ -457,7 +460,7 @@ public void testAbortBadParam() throws SQLException { try { conn.abort(null); } catch (SQLException e) { - assertTrue(e.getMessage().contains(TestResource.getResource("R_invalidArgumentExecutor"))); + assertTrue(e.getMessage().matches(TestUtils.formatErrorMsg("R_invalidArgument"))); } } } @@ -503,7 +506,8 @@ public void run() { ds.setServerName("invalidServerName" + UUID.randomUUID()); ds.setLoginTimeout(5); - try (Connection con = ds.getConnection()) {} catch (SQLException e) { + try (Connection con = ds.getConnection()) { + } catch (SQLException e) { isInterrupted = Thread.currentThread().isInterrupted(); } } diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/databasemetadata/DatabaseMetaDataTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/databasemetadata/DatabaseMetaDataTest.java index d19859888..caa99b9d7 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/databasemetadata/DatabaseMetaDataTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/databasemetadata/DatabaseMetaDataTest.java @@ -424,7 +424,7 @@ public void testGetFunctionsWithWrongParams() throws SQLException { conn.getMetaData().getFunctions("", null, "xp_%"); fail(TestResource.getResource("R_noSchemaShouldFail")); } catch (SQLException e) { - assert (e.getMessage().contains(TestResource.getResource("R_invalidArgumentCatalog"))); + assert (e.getMessage().matches(TestUtils.formatErrorMsg("R_invalidArgument"))); } }