You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by su...@apache.org on 2023/03/05 08:51:40 UTC
[shardingsphere] branch master updated: Refactor @Test(expected) to assert assertThrows on jdbc modules (#24467)
This is an automated email from the ASF dual-hosted git repository.
sunnianjun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 6f6d23881c8 Refactor @Test(expected) to assert assertThrows on jdbc modules (#24467)
6f6d23881c8 is described below
commit 6f6d23881c89b1a77d063ebd4928fddae7532333
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sun Mar 5 16:51:31 2023 +0800
Refactor @Test(expected) to assert assertThrows on jdbc modules (#24467)
* Refactor @Test(expected) to assert assertThrows on jdbc modules
---
.../driver/ShardingSphereDriverTest.java | 7 +-
.../batch/BatchPreparedStatementExecutorTest.java | 11 +-
.../driver/jdbc/adapter/WrapperAdapterTest.java | 7 +-
.../resultset/DatabaseMetaDataResultSetTest.java | 14 +-
.../GeneratedKeysResultSetMetaDataTest.java | 7 +-
.../core/resultset/GeneratedKeysResultSetTest.java | 7 +-
.../statement/EncryptPreparedStatementTest.java | 17 +-
.../jdbc/core/statement/EncryptStatementTest.java | 9 +-
.../ReadwriteSplittingPreparedStatementTest.java | 17 +-
.../statement/ReadwriteSplittingStatementTest.java | 9 +-
.../ShardingSpherePreparedStatementTest.java | 21 +-
.../statement/ShardingSphereStatementTest.java | 13 +-
.../UnSupportedDatabaseMetaDataResultSetTest.java | 133 +++---
.../UnsupportedGeneratedKeysResultSetTest.java | 231 +++++-----
.../UnsupportedOperationConnectionTest.java | 106 ++---
.../UnsupportedOperationParameterMetaTest.java | 50 +--
.../UnsupportedOperationPreparedStatementTest.java | 55 +--
.../UnsupportedOperationResultSetTest.java | 205 ++++-----
.../UnsupportedOperationStatementTest.java | 38 +-
.../UnsupportedUpdateOperationResultSetTest.java | 493 +++++++++++----------
20 files changed, 726 insertions(+), 724 deletions(-)
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/ShardingSphereDriverTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/ShardingSphereDriverTest.java
index 04e3d1bc77c..fb784059a05 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/ShardingSphereDriverTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/ShardingSphereDriverTest.java
@@ -30,13 +30,14 @@ import java.sql.Statement;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
public final class ShardingSphereDriverTest {
- @Test(expected = SQLException.class)
- public void assertConnectWithInvalidURL() throws SQLException {
- DriverManager.getConnection("jdbc:invalid:xxx");
+ @Test
+ public void assertConnectWithInvalidURL() {
+ assertThrows(SQLException.class, () -> DriverManager.getConnection("jdbc:invalid:xxx"));
}
@Test
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/executor/batch/BatchPreparedStatementExecutorTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/executor/batch/BatchPreparedStatementExecutorTest.java
index f4c3cf48028..53596387a11 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/executor/batch/BatchPreparedStatementExecutorTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/executor/batch/BatchPreparedStatementExecutorTest.java
@@ -46,6 +46,7 @@ import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertThrows;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
@@ -108,26 +109,24 @@ public final class BatchPreparedStatementExecutorTest extends AbstractBaseExecut
verify(preparedStatement2).executeBatch();
}
- @Test(expected = SQLException.class)
+ @Test
public void assertExecuteBatchForSinglePreparedStatementFailure() throws SQLException {
PreparedStatement preparedStatement = getPreparedStatement();
SQLException ex = new SQLException("");
when(preparedStatement.executeBatch()).thenThrow(ex);
setExecutionGroups(Collections.singletonList(preparedStatement));
- actual.executeBatch(sqlStatementContext);
+ assertThrows(SQLException.class, () -> actual.executeBatch(sqlStatementContext));
verify(preparedStatement).executeBatch();
}
- @Test(expected = SQLException.class)
+ @Test
public void assertExecuteBatchForMultiplePreparedStatementsFailure() throws SQLException {
PreparedStatement preparedStatement1 = getPreparedStatement();
PreparedStatement preparedStatement2 = getPreparedStatement();
SQLException ex = new SQLException("");
when(preparedStatement1.executeBatch()).thenThrow(ex);
setExecutionGroups(Arrays.asList(preparedStatement1, preparedStatement2));
- actual.executeBatch(sqlStatementContext);
- verify(preparedStatement1).executeBatch();
- verify(preparedStatement2).executeBatch();
+ assertThrows(SQLException.class, () -> actual.executeBatch(sqlStatementContext));
}
private void setExecutionGroups(final List<PreparedStatement> preparedStatements) {
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/adapter/WrapperAdapterTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/adapter/WrapperAdapterTest.java
index 16ee780f889..adba61fc696 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/adapter/WrapperAdapterTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/adapter/WrapperAdapterTest.java
@@ -30,6 +30,7 @@ import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
@@ -48,9 +49,9 @@ public final class WrapperAdapterTest {
assertThat(wrapperAdapter.unwrap(Object.class), is(wrapperAdapter));
}
- @Test(expected = SQLException.class)
- public void assertUnwrapFailure() throws SQLException {
- wrapperAdapter.unwrap(String.class);
+ @Test
+ public void assertUnwrapFailure() {
+ assertThrows(SQLException.class, () -> wrapperAdapter.unwrap(String.class));
}
@Test
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/DatabaseMetaDataResultSetTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/DatabaseMetaDataResultSetTest.java
index 975d0415e3d..15d60e812c3 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/DatabaseMetaDataResultSetTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/DatabaseMetaDataResultSetTest.java
@@ -40,6 +40,7 @@ import java.util.Optional;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertFalse;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -415,22 +416,21 @@ public final class DatabaseMetaDataResultSetTest {
assertThat(databaseMetaDataResultSet.getFetchSize(), is(3));
}
- @Test(expected = SQLException.class)
+ @Test
public void assertGetObjectOutOfIndexRange() throws SQLException {
databaseMetaDataResultSet.next();
- databaseMetaDataResultSet.getObject(9);
+ assertThrows(SQLException.class, () -> databaseMetaDataResultSet.getObject(9));
}
- @Test(expected = SQLException.class)
+ @Test
public void assertGetObjectInvalidLabel() throws SQLException {
databaseMetaDataResultSet.next();
- databaseMetaDataResultSet.getObject("Invalid");
+ assertThrows(SQLException.class, () -> databaseMetaDataResultSet.getObject("Invalid"));
}
- @Test(expected = SQLException.class)
+ @Test
public void assertOperationWithClose() throws SQLException {
databaseMetaDataResultSet.close();
- databaseMetaDataResultSet.next();
- databaseMetaDataResultSet.getObject(1);
+ assertThrows(SQLException.class, () -> databaseMetaDataResultSet.next());
}
}
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/GeneratedKeysResultSetMetaDataTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/GeneratedKeysResultSetMetaDataTest.java
index aa86592c758..def18674119 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/GeneratedKeysResultSetMetaDataTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/GeneratedKeysResultSetMetaDataTest.java
@@ -30,6 +30,7 @@ import java.util.Arrays;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertFalse;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
@@ -152,9 +153,9 @@ public final class GeneratedKeysResultSetMetaDataTest {
assertThat(actualMetaData.unwrap(GeneratedKeysResultSetMetaData.class), is((GeneratedKeysResultSetMetaData) actualMetaData));
}
- @Test(expected = SQLException.class)
- public void assertUnwrapError() throws SQLException {
- actualMetaData.unwrap(RowSetMetaDataImpl.class);
+ @Test
+ public void assertUnwrapError() {
+ assertThrows(SQLException.class, () -> actualMetaData.unwrap(RowSetMetaDataImpl.class));
}
@Test
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/GeneratedKeysResultSetTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/GeneratedKeysResultSetTest.java
index 632234adf66..08ca6eaa40b 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/GeneratedKeysResultSetTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/GeneratedKeysResultSetTest.java
@@ -28,8 +28,9 @@ import java.sql.Statement;
import java.util.Arrays;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertFalse;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
@@ -63,10 +64,10 @@ public final class GeneratedKeysResultSetTest {
assertTrue(actualResultSet.isClosed());
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void assertThrowExceptionWhenInvokeClosedResultSet() {
actualResultSet.close();
- actualResultSet.getType();
+ assertThrows(IllegalStateException.class, () -> actualResultSet.getType());
}
@Test
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptPreparedStatementTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptPreparedStatementTest.java
index 5ff1e408ef2..bae7a39f879 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptPreparedStatementTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptPreparedStatementTest.java
@@ -31,6 +31,7 @@ import java.sql.Statement;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
public final class EncryptPreparedStatementTest extends AbstractShardingSphereDataSourceForEncryptTest {
@@ -199,18 +200,14 @@ public final class EncryptPreparedStatementTest extends AbstractShardingSphereDa
}
}
- @Test(expected = SQLException.class)
- public void assertQueryWithNull() throws SQLException {
- try (PreparedStatement preparedStatement = getEncryptConnection().prepareStatement(null)) {
- preparedStatement.executeQuery();
- }
+ @Test
+ public void assertQueryWithNull() {
+ assertThrows(SQLException.class, () -> getEncryptConnection().prepareStatement(null));
}
- @Test(expected = SQLException.class)
- public void assertQueryWithEmptyString() throws SQLException {
- try (PreparedStatement preparedStatement = getEncryptConnection().prepareStatement("")) {
- preparedStatement.executeQuery();
- }
+ @Test
+ public void assertQueryWithEmptyString() {
+ assertThrows(SQLException.class, () -> getEncryptConnection().prepareStatement(""));
}
@Test
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptStatementTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptStatementTest.java
index d3cd6ec9f2c..d0281c0d17f 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptStatementTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptStatementTest.java
@@ -32,6 +32,7 @@ import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertFalse;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
public final class EncryptStatementTest extends AbstractShardingSphereDataSourceForEncryptTest {
@@ -183,17 +184,17 @@ public final class EncryptStatementTest extends AbstractShardingSphereDataSource
}
}
- @Test(expected = SQLException.class)
+ @Test
public void assertQueryWithNull() throws SQLException {
try (Statement statement = getEncryptConnection().createStatement()) {
- statement.executeQuery(null);
+ assertThrows(SQLException.class, () -> statement.executeQuery(null));
}
}
- @Test(expected = SQLException.class)
+ @Test
public void assertQueryWithEmptyString() throws SQLException {
try (Statement statement = getEncryptConnection().createStatement()) {
- statement.executeQuery("");
+ assertThrows(SQLException.class, () -> statement.executeQuery(""));
}
}
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ReadwriteSplittingPreparedStatementTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ReadwriteSplittingPreparedStatementTest.java
index 1d28b919401..bea895a5444 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ReadwriteSplittingPreparedStatementTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ReadwriteSplittingPreparedStatementTest.java
@@ -31,22 +31,19 @@ import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
public final class ReadwriteSplittingPreparedStatementTest extends AbstractShardingSphereDataSourceForReadwriteSplittingTest {
- @Test(expected = SQLException.class)
- public void assertQueryWithNull() throws SQLException {
- try (PreparedStatement preparedStatement = getReadwriteSplittingDataSource().getConnection().prepareStatement(null)) {
- preparedStatement.executeQuery();
- }
+ @Test
+ public void assertQueryWithNull() {
+ assertThrows(SQLException.class, () -> getReadwriteSplittingDataSource().getConnection().prepareStatement(null));
}
- @Test(expected = SQLException.class)
- public void assertQueryWithEmptyString() throws SQLException {
- try (PreparedStatement preparedStatement = getReadwriteSplittingDataSource().getConnection().prepareStatement("")) {
- preparedStatement.executeQuery();
- }
+ @Test
+ public void assertQueryWithEmptyString() {
+ assertThrows(SQLException.class, () -> getReadwriteSplittingDataSource().getConnection().prepareStatement(""));
}
@Test
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ReadwriteSplittingStatementTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ReadwriteSplittingStatementTest.java
index a4ffb470ab5..28a123bba63 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ReadwriteSplittingStatementTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ReadwriteSplittingStatementTest.java
@@ -26,21 +26,22 @@ import java.sql.Statement;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
public final class ReadwriteSplittingStatementTest extends AbstractShardingSphereDataSourceForReadwriteSplittingTest {
- @Test(expected = SQLException.class)
+ @Test
public void assertQueryWithNull() throws SQLException {
try (Statement statement = getReadwriteSplittingDataSource().getConnection().createStatement()) {
- statement.executeQuery(null);
+ assertThrows(SQLException.class, () -> statement.executeQuery(null));
}
}
- @Test(expected = SQLException.class)
+ @Test
public void assertQueryWithEmptyString() throws SQLException {
try (Statement statement = getReadwriteSplittingDataSource().getConnection().createStatement()) {
- statement.executeQuery("");
+ assertThrows(SQLException.class, () -> statement.executeQuery(""));
}
}
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatementTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatementTest.java
index 1a129c6c852..79f6c5c8271 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatementTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatementTest.java
@@ -33,6 +33,7 @@ import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
public final class ShardingSpherePreparedStatementTest extends AbstractShardingSphereDataSourceForShardingTest {
@@ -586,18 +587,14 @@ public final class ShardingSpherePreparedStatementTest extends AbstractShardingS
}
}
- @Test(expected = SQLException.class)
- public void assertQueryWithNull() throws SQLException {
- try (PreparedStatement preparedStatement = getShardingSphereDataSource().getConnection().prepareStatement(null)) {
- preparedStatement.executeQuery();
- }
+ @Test
+ public void assertQueryWithNull() {
+ assertThrows(SQLException.class, () -> getShardingSphereDataSource().getConnection().prepareStatement(null));
}
- @Test(expected = SQLException.class)
- public void assertQueryWithEmptyString() throws SQLException {
- try (PreparedStatement preparedStatement = getShardingSphereDataSource().getConnection().prepareStatement("")) {
- preparedStatement.executeQuery();
- }
+ @Test
+ public void assertQueryWithEmptyString() {
+ assertThrows(SQLException.class, () -> getShardingSphereDataSource().getConnection().prepareStatement(""));
}
@Test
@@ -607,11 +604,11 @@ public final class ShardingSpherePreparedStatementTest extends AbstractShardingS
}
}
- @Test(expected = SQLException.class)
+ @Test
public void assertColumnNotFoundException() throws SQLException {
try (PreparedStatement preparedStatement = getShardingSphereDataSource().getConnection().prepareStatement(UPDATE_WITH_ERROR_COLUMN)) {
preparedStatement.setString(1, "OK");
- preparedStatement.executeUpdate();
+ assertThrows(SQLException.class, preparedStatement::executeUpdate);
}
}
}
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSphereStatementTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSphereStatementTest.java
index 25b42ba668d..133ecc2e122 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSphereStatementTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSphereStatementTest.java
@@ -30,6 +30,7 @@ import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
public final class ShardingSphereStatementTest extends AbstractShardingSphereDataSourceForShardingTest {
@@ -76,17 +77,17 @@ public final class ShardingSphereStatementTest extends AbstractShardingSphereDat
}
}
- @Test(expected = SQLException.class)
+ @Test
public void assertQueryWithNull() throws SQLException {
try (Statement statement = getShardingSphereDataSource().getConnection().createStatement()) {
- statement.executeQuery(null);
+ assertThrows(SQLException.class, () -> statement.executeQuery(null));
}
}
- @Test(expected = SQLException.class)
+ @Test
public void assertQueryWithEmptyString() throws SQLException {
try (Statement statement = getShardingSphereDataSource().getConnection().createStatement()) {
- statement.executeQuery("");
+ assertThrows(SQLException.class, () -> statement.executeQuery(""));
}
}
@@ -108,11 +109,11 @@ public final class ShardingSphereStatementTest extends AbstractShardingSphereDat
}
}
- @Test(expected = SQLException.class)
+ @Test
public void assertColumnNotFoundException() throws SQLException {
String sql = "UPDATE t_order_item SET error_column = '%s'";
try (Statement statement = getShardingSphereDataSource().getConnection().createStatement()) {
- statement.executeUpdate(String.format(sql, "OK"));
+ assertThrows(SQLException.class, () -> statement.executeUpdate(String.format(sql, "OK")));
}
}
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnSupportedDatabaseMetaDataResultSetTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnSupportedDatabaseMetaDataResultSetTest.java
index 411f47be667..1361335b7a3 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnSupportedDatabaseMetaDataResultSetTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnSupportedDatabaseMetaDataResultSetTest.java
@@ -26,6 +26,7 @@ import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
+import static org.junit.Assert.assertThrows;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -41,113 +42,113 @@ public final class UnSupportedDatabaseMetaDataResultSetTest {
databaseMetaDataResultSet = new DatabaseMetaDataResultSet(resultSet, null);
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetAsciiStreamWithIndex() throws SQLException {
- databaseMetaDataResultSet.getAsciiStream(1);
+ @Test
+ public void assertGetAsciiStreamWithIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getAsciiStream(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetAsciiStreamWithLabel() throws SQLException {
- databaseMetaDataResultSet.getAsciiStream("");
+ @Test
+ public void assertGetAsciiStreamWithLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getAsciiStream(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetUnicodeStreamWithIndex() throws SQLException {
- databaseMetaDataResultSet.getUnicodeStream(1);
+ @Test
+ public void assertGetUnicodeStreamWithIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getUnicodeStream(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetUnicodeStreamWithLabel() throws SQLException {
- databaseMetaDataResultSet.getUnicodeStream("");
+ @Test
+ public void assertGetUnicodeStreamWithLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getUnicodeStream(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetBinaryStreamWithIndex() throws SQLException {
- databaseMetaDataResultSet.getBinaryStream(1);
+ @Test
+ public void assertGetBinaryStreamWithIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getBinaryStream(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetBinaryStreamWithLabel() throws SQLException {
- databaseMetaDataResultSet.getBinaryStream("");
+ @Test
+ public void assertGetBinaryStreamWithLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getBinaryStream(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetWarnings() throws SQLException {
- databaseMetaDataResultSet.getWarnings();
+ @Test
+ public void assertGetWarnings() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getWarnings());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertClearWarnings() throws SQLException {
- databaseMetaDataResultSet.clearWarnings();
+ @Test
+ public void assertClearWarnings() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.clearWarnings());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetCharacterStreamWithIndex() throws SQLException {
- databaseMetaDataResultSet.getCharacterStream(1);
+ @Test
+ public void assertGetCharacterStreamWithIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getCharacterStream(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetCharacterStreamWithLabel() throws SQLException {
- databaseMetaDataResultSet.getCharacterStream("");
+ @Test
+ public void assertGetCharacterStreamWithLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getCharacterStream(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetBlobWithIndex() throws SQLException {
- databaseMetaDataResultSet.getBlob(1);
+ @Test
+ public void assertGetBlobWithIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getBlob(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetBlobWithLabel() throws SQLException {
- databaseMetaDataResultSet.getBlob("");
+ @Test
+ public void assertGetBlobWithLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getBlob(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetClobWithIndex() throws SQLException {
- databaseMetaDataResultSet.getClob(1);
+ @Test
+ public void assertGetClobWithIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getClob(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetClobWithLabel() throws SQLException {
- databaseMetaDataResultSet.getClob("");
+ @Test
+ public void assertGetClobWithLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getClob(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetDateWithIndexAndCalendar() throws SQLException {
- databaseMetaDataResultSet.getDate(1, null);
+ @Test
+ public void assertGetDateWithIndexAndCalendar() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getDate(1, null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetDateWithLabelAndCalendar() throws SQLException {
- databaseMetaDataResultSet.getDate("", null);
+ @Test
+ public void assertGetDateWithLabelAndCalendar() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getDate("", null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetTimeWithIndexAndCalendar() throws SQLException {
- databaseMetaDataResultSet.getTime(1, null);
+ @Test
+ public void assertGetTimeWithIndexAndCalendar() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getTime(1, null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetTimeWithLabelAndCalendar() throws SQLException {
- databaseMetaDataResultSet.getTime("", null);
+ @Test
+ public void assertGetTimeWithLabelAndCalendar() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getTime("", null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetTimestampWithIndexAndCalendar() throws SQLException {
- databaseMetaDataResultSet.getTimestamp(1, null);
+ @Test
+ public void assertGetTimestampWithIndexAndCalendar() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getTimestamp(1, null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetTimestampWithLabelAndCalendar() throws SQLException {
- databaseMetaDataResultSet.getTimestamp("", null);
+ @Test
+ public void assertGetTimestampWithLabelAndCalendar() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getTimestamp("", null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetSQLXMLWithIndex() throws SQLException {
- databaseMetaDataResultSet.getSQLXML(1);
+ @Test
+ public void assertGetSQLXMLWithIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getSQLXML(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetSQLXMLWithLabel() throws SQLException {
- databaseMetaDataResultSet.getSQLXML("");
+ @Test
+ public void assertGetSQLXMLWithLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> databaseMetaDataResultSet.getSQLXML(""));
}
}
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedGeneratedKeysResultSetTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedGeneratedKeysResultSetTest.java
index 10f692393cb..fffb6b4f88e 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedGeneratedKeysResultSetTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedGeneratedKeysResultSetTest.java
@@ -21,199 +21,200 @@ import org.apache.shardingsphere.driver.jdbc.core.resultset.GeneratedKeysResultS
import org.junit.Test;
import java.sql.ResultSet;
-import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.Collections;
+import static org.junit.Assert.assertThrows;
+
public final class UnsupportedGeneratedKeysResultSetTest {
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getBooleanWithColumnIndex() throws SQLException {
- new GeneratedKeysResultSet().getBoolean(1);
+ @Test
+ public void getBooleanWithColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getBoolean(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getBooleanWithColumnLabel() throws SQLException {
- new GeneratedKeysResultSet().getBoolean("");
+ @Test
+ public void getBooleanWithColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getBoolean(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getDateWithColumnIndex() throws SQLException {
- new GeneratedKeysResultSet().getDate(1);
+ @Test
+ public void getDateWithColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getDate(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getDateWithColumnIndexAndCalendar() throws SQLException {
- new GeneratedKeysResultSet().getDate(1, null);
+ @Test
+ public void getDateWithColumnIndexAndCalendar() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getDate(1, null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getDateWithWithColumnLabel() throws SQLException {
- new GeneratedKeysResultSet().getDate("");
+ @Test
+ public void getDateWithWithColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getDate(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getDateWithColumnLabelAndCalendar() throws SQLException {
- new GeneratedKeysResultSet().getDate("", null);
+ @Test
+ public void getDateWithColumnLabelAndCalendar() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getDate("", null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getTimeWithColumnIndex() throws SQLException {
- new GeneratedKeysResultSet().getTime(1);
+ @Test
+ public void getTimeWithColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getTime(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getTimeWithColumnIndexAndCalendar() throws SQLException {
- new GeneratedKeysResultSet().getTime(1, null);
+ @Test
+ public void getTimeWithColumnIndexAndCalendar() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getTime(1, null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getTimeWithColumnLabel() throws SQLException {
- new GeneratedKeysResultSet().getTime("");
+ @Test
+ public void getTimeWithColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getTime(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getTimeWithColumnLabelAndCalendar() throws SQLException {
- new GeneratedKeysResultSet().getTime("", null);
+ @Test
+ public void getTimeWithColumnLabelAndCalendar() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getTime("", null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getTimestampWithColumnIndex() throws SQLException {
- new GeneratedKeysResultSet().getTimestamp(1);
+ @Test
+ public void getTimestampWithColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getTimestamp(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getTimestampWithColumnIndexAndCalendar() throws SQLException {
- new GeneratedKeysResultSet().getTimestamp(1, null);
+ @Test
+ public void getTimestampWithColumnIndexAndCalendar() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getTimestamp(1, null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getTimestampWithColumnLabel() throws SQLException {
- new GeneratedKeysResultSet().getTimestamp("");
+ @Test
+ public void getTimestampWithColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getTimestamp(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getTimestampWithColumnLabelAndCalendar() throws SQLException {
- new GeneratedKeysResultSet().getTimestamp("", null);
+ @Test
+ public void getTimestampWithColumnLabelAndCalendar() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getTimestamp("", null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getAsciiStreamWithColumnIndex() throws SQLException {
- new GeneratedKeysResultSet().getAsciiStream(1);
+ @Test
+ public void getAsciiStreamWithColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getAsciiStream(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getAsciiStreamWithColumnLabel() throws SQLException {
- new GeneratedKeysResultSet().getAsciiStream("");
+ @Test
+ public void getAsciiStreamWithColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getAsciiStream(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getUnicodeStreamWithColumnIndex() throws SQLException {
- new GeneratedKeysResultSet().getUnicodeStream(1);
+ @Test
+ public void getUnicodeStreamWithColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getUnicodeStream(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getUnicodeStreamWithColumnLabel() throws SQLException {
- new GeneratedKeysResultSet().getUnicodeStream("");
+ @Test
+ public void getUnicodeStreamWithColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getUnicodeStream(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getBinaryStreamWithColumnIndex() throws SQLException {
- new GeneratedKeysResultSet().getBinaryStream(1);
+ @Test
+ public void getBinaryStreamWithColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getBinaryStream(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getBinaryStreamWithColumnLabel() throws SQLException {
- new GeneratedKeysResultSet().getBinaryStream("");
+ @Test
+ public void getBinaryStreamWithColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getBinaryStream(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getCharacterStreamWithColumnIndex() throws SQLException {
- new GeneratedKeysResultSet().getCharacterStream(1);
+ @Test
+ public void getCharacterStreamWithColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getCharacterStream(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getCharacterStreamWithColumnLabel() throws SQLException {
- new GeneratedKeysResultSet().getCharacterStream("");
+ @Test
+ public void getCharacterStreamWithColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getCharacterStream(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getBlobWithColumnIndex() throws SQLException {
- new GeneratedKeysResultSet().getBlob(1);
+ @Test
+ public void getBlobWithColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getBlob(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getBlobWithColumnLabel() throws SQLException {
- new GeneratedKeysResultSet().getBlob("");
+ @Test
+ public void getBlobWithColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getBlob(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getClobWithColumnIndex() throws SQLException {
- new GeneratedKeysResultSet().getClob(1);
+ @Test
+ public void getClobWithColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getClob(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getClobWithColumnLabel() throws SQLException {
- new GeneratedKeysResultSet().getClob("");
+ @Test
+ public void getClobWithColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getClob(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getURLWithColumnIndex() throws SQLException {
- new GeneratedKeysResultSet().getURL(1);
+ @Test
+ public void getURLWithColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getURL(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getURLWithColumnLabel() throws SQLException {
- new GeneratedKeysResultSet().getURL("");
+ @Test
+ public void getURLWithColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getURL(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getSQLXMLWithColumnIndex() throws SQLException {
- new GeneratedKeysResultSet().getSQLXML(1);
+ @Test
+ public void getSQLXMLWithColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getSQLXML(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getSQLXMLWithColumnLabel() throws SQLException {
- new GeneratedKeysResultSet().getSQLXML("");
+ @Test
+ public void getSQLXMLWithColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getSQLXML(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getObjectWithColumnIndex() throws SQLException {
- new GeneratedKeysResultSet().getObject(1, Collections.emptyMap());
+ @Test
+ public void getObjectWithColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getObject(1, Collections.emptyMap()));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getObjectWithColumnLabel() throws SQLException {
- new GeneratedKeysResultSet().getObject("", Collections.emptyMap());
+ @Test
+ public void getObjectWithColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getObject("", Collections.emptyMap()));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void setFetchDirection() throws SQLException {
- new GeneratedKeysResultSet().setFetchDirection(ResultSet.FETCH_FORWARD);
+ @Test
+ public void setFetchDirection() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().setFetchDirection(ResultSet.FETCH_FORWARD));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getFetchDirection() throws SQLException {
- new GeneratedKeysResultSet().getFetchDirection();
+ @Test
+ public void getFetchDirection() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getFetchDirection());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void setFetchSize() throws SQLException {
- new GeneratedKeysResultSet().setFetchSize(1);
+ @Test
+ public void setFetchSize() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().setFetchSize(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getFetchSize() throws SQLException {
- new GeneratedKeysResultSet().getFetchSize();
+ @Test
+ public void getFetchSize() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getFetchSize());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getWarnings() throws SQLException {
- new GeneratedKeysResultSet().getWarnings();
+ @Test
+ public void getWarnings() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().getWarnings());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void clearWarnings() throws SQLException {
- new GeneratedKeysResultSet().clearWarnings();
+ @Test
+ public void clearWarnings() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> new GeneratedKeysResultSet().clearWarnings());
}
}
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationConnectionTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationConnectionTest.java
index 37abda018a1..2c9e9edcc20 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationConnectionTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationConnectionTest.java
@@ -29,11 +29,11 @@ import org.apache.shardingsphere.transaction.rule.TransactionRule;
import org.junit.After;
import org.junit.Test;
-import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.Arrays;
import java.util.Properties;
+import static org.junit.Assert.assertThrows;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -49,94 +49,94 @@ public final class UnsupportedOperationConnectionTest {
shardingSphereConnection = new ShardingSphereConnection(DefaultDatabase.LOGIC_NAME, contextManager, mock(JDBCContext.class));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertPrepareCall() throws SQLException {
- shardingSphereConnection.prepareCall("");
+ @Test
+ public void assertPrepareCall() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereConnection.prepareCall(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertPrepareCallWithResultSetTypeAndResultSetConcurrency() throws SQLException {
- shardingSphereConnection.prepareCall("", 0, 0);
+ @Test
+ public void assertPrepareCallWithResultSetTypeAndResultSetConcurrency() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereConnection.prepareCall("", 0, 0));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertPrepareCallWithResultSetTypeAndResultSetConcurrencyAndResultSetHoldability() throws SQLException {
- shardingSphereConnection.prepareCall("", 0, 0, 0);
+ @Test
+ public void assertPrepareCallWithResultSetTypeAndResultSetConcurrencyAndResultSetHoldability() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereConnection.prepareCall("", 0, 0, 0));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertNativeSQL() throws SQLException {
- shardingSphereConnection.nativeSQL("");
+ @Test
+ public void assertNativeSQL() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereConnection.nativeSQL(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertAbort() throws SQLException {
- shardingSphereConnection.abort(null);
+ @Test
+ public void assertAbort() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereConnection.abort(null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetTypeMap() throws SQLException {
- shardingSphereConnection.getTypeMap();
+ @Test
+ public void assertGetTypeMap() {
+ assertThrows(SQLFeatureNotSupportedException.class, shardingSphereConnection::getTypeMap);
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertSetTypeMap() throws SQLException {
- shardingSphereConnection.setTypeMap(null);
+ @Test
+ public void assertSetTypeMap() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereConnection.setTypeMap(null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetNetworkTimeout() throws SQLException {
- shardingSphereConnection.getNetworkTimeout();
+ @Test
+ public void assertGetNetworkTimeout() {
+ assertThrows(SQLFeatureNotSupportedException.class, shardingSphereConnection::getNetworkTimeout);
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertSetNetworkTimeout() throws SQLException {
- shardingSphereConnection.setNetworkTimeout(null, 0);
+ @Test
+ public void assertSetNetworkTimeout() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereConnection.setNetworkTimeout(null, 0));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertCreateClob() throws SQLException {
- shardingSphereConnection.createClob();
+ @Test
+ public void assertCreateClob() {
+ assertThrows(SQLFeatureNotSupportedException.class, shardingSphereConnection::createClob);
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertCreateBlob() throws SQLException {
- shardingSphereConnection.createBlob();
+ @Test
+ public void assertCreateBlob() {
+ assertThrows(SQLFeatureNotSupportedException.class, shardingSphereConnection::createBlob);
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertCreateNClob() throws SQLException {
- shardingSphereConnection.createNClob();
+ @Test
+ public void assertCreateNClob() {
+ assertThrows(SQLFeatureNotSupportedException.class, shardingSphereConnection::createNClob);
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertCreateSQLXML() throws SQLException {
- shardingSphereConnection.createSQLXML();
+ @Test
+ public void assertCreateSQLXML() {
+ assertThrows(SQLFeatureNotSupportedException.class, shardingSphereConnection::createSQLXML);
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertCreateStruct() throws SQLException {
- shardingSphereConnection.createStruct("", null);
+ @Test
+ public void assertCreateStruct() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereConnection.createStruct("", null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetClientInfo() throws SQLException {
- shardingSphereConnection.getClientInfo();
+ @Test
+ public void assertGetClientInfo() {
+ assertThrows(SQLFeatureNotSupportedException.class, shardingSphereConnection::getClientInfo);
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetClientInfoWithName() throws SQLException {
- shardingSphereConnection.getClientInfo("");
+ @Test
+ public void assertGetClientInfoWithName() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereConnection.getClientInfo(""));
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertSetClientInfo() {
- shardingSphereConnection.setClientInfo("", "");
+ assertThrows(UnsupportedSQLOperationException.class, () -> shardingSphereConnection.setClientInfo("", ""));
}
- @Test(expected = UnsupportedSQLOperationException.class)
+ @Test
public void assertSetClientInfoWithProperties() {
- shardingSphereConnection.setClientInfo(new Properties());
+ assertThrows(UnsupportedSQLOperationException.class, () -> shardingSphereConnection.setClientInfo(new Properties()));
}
@After
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationParameterMetaTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationParameterMetaTest.java
index 08bc9c7b19d..c4970aaa8a9 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationParameterMetaTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationParameterMetaTest.java
@@ -21,52 +21,52 @@ import org.apache.shardingsphere.driver.jdbc.core.statement.metadata.ShardingSph
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
import org.junit.Test;
-import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
+import static org.junit.Assert.assertThrows;
import static org.mockito.Mockito.mock;
public final class UnsupportedOperationParameterMetaTest {
private final ShardingSphereParameterMetaData shardingSphereParameterMetaData = new ShardingSphereParameterMetaData(mock(SQLStatement.class));
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertIsNullable() throws SQLException {
- shardingSphereParameterMetaData.getParameterClassName(1);
+ @Test
+ public void assertIsNullable() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereParameterMetaData.getParameterClassName(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertIsSigned() throws SQLException {
- shardingSphereParameterMetaData.isSigned(1);
+ @Test
+ public void assertIsSigned() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereParameterMetaData.isSigned(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetPrecision() throws SQLException {
- shardingSphereParameterMetaData.getPrecision(1);
+ @Test
+ public void assertGetPrecision() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereParameterMetaData.getPrecision(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetScale() throws SQLException {
- shardingSphereParameterMetaData.getScale(1);
+ @Test
+ public void assertGetScale() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereParameterMetaData.getScale(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetParameterType() throws SQLException {
- shardingSphereParameterMetaData.getParameterType(1);
+ @Test
+ public void assertGetParameterType() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereParameterMetaData.getParameterType(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetParameterTypeName() throws SQLException {
- shardingSphereParameterMetaData.getParameterTypeName(1);
+ @Test
+ public void assertGetParameterTypeName() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereParameterMetaData.getParameterTypeName(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetParameterClassName() throws SQLException {
- shardingSphereParameterMetaData.getParameterClassName(1);
+ @Test
+ public void assertGetParameterClassName() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereParameterMetaData.getParameterClassName(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetParameterMode() throws SQLException {
- shardingSphereParameterMetaData.getParameterMode(1);
+ @Test
+ public void assertGetParameterMode() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereParameterMetaData.getParameterMode(1));
}
}
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationPreparedStatementTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationPreparedStatementTest.java
index 3b835ed2368..852757de6eb 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationPreparedStatementTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationPreparedStatementTest.java
@@ -39,6 +39,7 @@ import java.sql.SQLFeatureNotSupportedException;
import java.util.Arrays;
import java.util.Properties;
+import static org.junit.Assert.assertThrows;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -60,48 +61,48 @@ public final class UnsupportedOperationPreparedStatementTest {
shardingSpherePreparedStatement = new ShardingSpherePreparedStatement(connection, "SELECT 1");
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetMetaData() throws SQLException {
- shardingSpherePreparedStatement.getMetaData();
+ @Test
+ public void assertGetMetaData() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSpherePreparedStatement.getMetaData());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertSetNString() throws SQLException {
- shardingSpherePreparedStatement.setNString(1, "");
+ @Test
+ public void assertSetNString() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSpherePreparedStatement.setNString(1, ""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertSetNClob() throws SQLException {
- shardingSpherePreparedStatement.setNClob(1, (NClob) null);
+ @Test
+ public void assertSetNClob() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSpherePreparedStatement.setNClob(1, (NClob) null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertSetNClobForReader() throws SQLException {
- shardingSpherePreparedStatement.setNClob(1, new StringReader(""));
+ @Test
+ public void assertSetNClobForReader() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSpherePreparedStatement.setNClob(1, new StringReader("")));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertSetNClobForReaderAndLength() throws SQLException {
- shardingSpherePreparedStatement.setNClob(1, new StringReader(""), 1);
+ @Test
+ public void assertSetNClobForReaderAndLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSpherePreparedStatement.setNClob(1, new StringReader(""), 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertSetNCharacterStream() throws SQLException {
- shardingSpherePreparedStatement.setNCharacterStream(1, new StringReader(""));
+ @Test
+ public void assertSetNCharacterStream() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSpherePreparedStatement.setNCharacterStream(1, new StringReader("")));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertSetNCharacterStreamWithLength() throws SQLException {
- shardingSpherePreparedStatement.setNCharacterStream(1, new StringReader(""), 1);
+ @Test
+ public void assertSetNCharacterStreamWithLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSpherePreparedStatement.setNCharacterStream(1, new StringReader(""), 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertSetRowId() throws SQLException {
- shardingSpherePreparedStatement.setRowId(1, null);
+ @Test
+ public void assertSetRowId() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSpherePreparedStatement.setRowId(1, null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertSetRef() throws SQLException {
- shardingSpherePreparedStatement.setRef(1, null);
+ @Test
+ public void assertSetRef() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSpherePreparedStatement.setRef(1, null));
}
}
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationResultSetTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationResultSetTest.java
index 6cb54fa0184..e2303351703 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationResultSetTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationResultSetTest.java
@@ -29,6 +29,7 @@ import java.sql.SQLFeatureNotSupportedException;
import java.sql.Statement;
import java.util.Collections;
+import static org.junit.Assert.assertThrows;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
@@ -42,173 +43,173 @@ public final class UnsupportedOperationResultSetTest {
Collections.singletonList(mock(ResultSet.class, RETURNS_DEEP_STUBS)), mock(MergedResult.class), mock(Statement.class), mock(ExecutionContext.class));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertPrevious() throws SQLException {
- shardingSphereResultSet.previous();
+ @Test
+ public void assertPrevious() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.previous());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertIsBeforeFirst() throws SQLException {
- shardingSphereResultSet.isBeforeFirst();
+ @Test
+ public void assertIsBeforeFirst() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.isBeforeFirst());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertIsAfterLast() throws SQLException {
- shardingSphereResultSet.isAfterLast();
+ @Test
+ public void assertIsAfterLast() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.isAfterLast());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertIsFirst() throws SQLException {
- shardingSphereResultSet.isFirst();
+ @Test
+ public void assertIsFirst() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.isFirst());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertIsLast() throws SQLException {
- shardingSphereResultSet.isLast();
+ @Test
+ public void assertIsLast() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.isLast());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertBeforeFirst() throws SQLException {
- shardingSphereResultSet.beforeFirst();
+ @Test
+ public void assertBeforeFirst() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.beforeFirst());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertAfterLast() throws SQLException {
- shardingSphereResultSet.afterLast();
+ @Test
+ public void assertAfterLast() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.afterLast());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertFirst() throws SQLException {
- shardingSphereResultSet.first();
+ @Test
+ public void assertFirst() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.first());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertLast() throws SQLException {
- shardingSphereResultSet.last();
+ @Test
+ public void assertLast() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.last());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertAbsolute() throws SQLException {
- shardingSphereResultSet.absolute(1);
+ @Test
+ public void assertAbsolute() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.absolute(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertRelative() throws SQLException {
- shardingSphereResultSet.relative(1);
+ @Test
+ public void assertRelative() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.relative(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetRow() throws SQLException {
- shardingSphereResultSet.getRow();
+ @Test
+ public void assertGetRow() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.getRow());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertInsertRow() throws SQLException {
- shardingSphereResultSet.insertRow();
+ @Test
+ public void assertInsertRow() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.insertRow());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateRow() throws SQLException {
- shardingSphereResultSet.updateRow();
+ @Test
+ public void assertUpdateRow() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateRow());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertDeleteRow() throws SQLException {
- shardingSphereResultSet.deleteRow();
+ @Test
+ public void assertDeleteRow() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.deleteRow());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertRefreshRow() throws SQLException {
- shardingSphereResultSet.refreshRow();
+ @Test
+ public void assertRefreshRow() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.refreshRow());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertCancelRowUpdates() throws SQLException {
- shardingSphereResultSet.cancelRowUpdates();
+ @Test
+ public void assertCancelRowUpdates() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.cancelRowUpdates());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertMoveToInsertRow() throws SQLException {
- shardingSphereResultSet.moveToInsertRow();
+ @Test
+ public void assertMoveToInsertRow() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.moveToInsertRow());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertMoveToCurrentRow() throws SQLException {
- shardingSphereResultSet.moveToCurrentRow();
+ @Test
+ public void assertMoveToCurrentRow() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.moveToCurrentRow());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertRowInserted() throws SQLException {
- shardingSphereResultSet.rowInserted();
+ @Test
+ public void assertRowInserted() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.rowInserted());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertRowUpdated() throws SQLException {
- shardingSphereResultSet.rowUpdated();
+ @Test
+ public void assertRowUpdated() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.rowUpdated());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertRowDeleted() throws SQLException {
- shardingSphereResultSet.rowDeleted();
+ @Test
+ public void assertRowDeleted() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.rowDeleted());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetCursorName() throws SQLException {
- shardingSphereResultSet.getCursorName();
+ @Test
+ public void assertGetCursorName() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.getCursorName());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetHoldability() throws SQLException {
- shardingSphereResultSet.getHoldability();
+ @Test
+ public void assertGetHoldability() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.getHoldability());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetNClobForColumnIndex() throws SQLException {
- shardingSphereResultSet.getNClob(1);
+ @Test
+ public void assertGetNClobForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.getNClob(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetNClobForColumnLabel() throws SQLException {
- shardingSphereResultSet.getNClob("label");
+ @Test
+ public void assertGetNClobForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.getNClob("label"));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getNCharacterStreamForColumnIndex() throws SQLException {
- shardingSphereResultSet.getNCharacterStream(1);
+ @Test
+ public void getNCharacterStreamForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.getNCharacterStream(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void getNCharacterStreamForColumnLabel() throws SQLException {
- shardingSphereResultSet.getNCharacterStream("label");
+ @Test
+ public void getNCharacterStreamForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.getNCharacterStream("label"));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetRefForColumnIndex() throws SQLException {
- shardingSphereResultSet.getRef(1);
+ @Test
+ public void assertGetRefForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.getRef(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetRefForColumnLabel() throws SQLException {
- shardingSphereResultSet.getRef("label");
+ @Test
+ public void assertGetRefForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.getRef("label"));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetRowIdForColumnIndex() throws SQLException {
- shardingSphereResultSet.getRowId(1);
+ @Test
+ public void assertGetRowIdForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.getRowId(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertGetRowIdForColumnLabel() throws SQLException {
- shardingSphereResultSet.getRowId("label");
+ @Test
+ public void assertGetRowIdForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.getRowId("label"));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertObjectForColumnIndexWithMap() throws SQLException {
- shardingSphereResultSet.getObject(1, Collections.emptyMap());
+ @Test
+ public void assertObjectForColumnIndexWithMap() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.getObject(1, Collections.emptyMap()));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertObjectForColumnLabelWithMap() throws SQLException {
- shardingSphereResultSet.getObject("label", Collections.emptyMap());
+ @Test
+ public void assertObjectForColumnLabelWithMap() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.getObject("label", Collections.emptyMap()));
}
}
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationStatementTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationStatementTest.java
index f60fc185e3c..efad2494588 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationStatementTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationStatementTest.java
@@ -30,11 +30,11 @@ import org.apache.shardingsphere.traffic.rule.builder.DefaultTrafficRuleConfigur
import org.junit.Before;
import org.junit.Test;
-import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.Arrays;
import java.util.Properties;
+import static org.junit.Assert.assertThrows;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -55,33 +55,33 @@ public final class UnsupportedOperationStatementTest {
shardingSphereStatement = new ShardingSphereStatement(connection);
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertAddBatch() throws SQLException {
- shardingSphereStatement.addBatch("");
+ @Test
+ public void assertAddBatch() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereStatement.addBatch(""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertClearBatch() throws SQLException {
- shardingSphereStatement.clearBatch();
+ @Test
+ public void assertClearBatch() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereStatement.clearBatch());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertExecuteBatch() throws SQLException {
- shardingSphereStatement.executeBatch();
+ @Test
+ public void assertExecuteBatch() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereStatement.executeBatch());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertCloseOnCompletion() throws SQLException {
- shardingSphereStatement.closeOnCompletion();
+ @Test
+ public void assertCloseOnCompletion() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereStatement.closeOnCompletion());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertIsCloseOnCompletion() throws SQLException {
- shardingSphereStatement.isCloseOnCompletion();
+ @Test
+ public void assertIsCloseOnCompletion() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereStatement.isCloseOnCompletion());
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertSetCursorName() throws SQLException {
- shardingSphereStatement.setCursorName("cursorName");
+ @Test
+ public void assertSetCursorName() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereStatement.setCursorName("cursorName"));
}
}
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedUpdateOperationResultSetTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedUpdateOperationResultSetTest.java
index c1a458127c4..af7074639f2 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedUpdateOperationResultSetTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedUpdateOperationResultSetTest.java
@@ -37,6 +37,7 @@ import java.sql.Time;
import java.sql.Timestamp;
import java.util.Collections;
+import static org.junit.Assert.assertThrows;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
@@ -50,413 +51,413 @@ public final class UnsupportedUpdateOperationResultSetTest {
Collections.singletonList(mock(ResultSet.class, RETURNS_DEEP_STUBS)), mock(MergedResult.class), mock(Statement.class), mock(ExecutionContext.class));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateNullForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateNull(1);
+ @Test
+ public void assertUpdateNullForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateNull(1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateNullForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateNull("label");
+ @Test
+ public void assertUpdateNullForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateNull("label"));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBooleanForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateBoolean(1, false);
+ @Test
+ public void assertUpdateBooleanForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBoolean(1, false));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBooleanForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateBoolean("label", false);
+ @Test
+ public void assertUpdateBooleanForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBoolean("label", false));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateByteForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateByte(1, (byte) 1);
+ @Test
+ public void assertUpdateByteForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateByte(1, (byte) 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateByteForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateByte("label", (byte) 1);
+ @Test
+ public void assertUpdateByteForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateByte("label", (byte) 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateShortForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateShort(1, (short) 1);
+ @Test
+ public void assertUpdateShortForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateShort(1, (short) 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateShortForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateShort("label", (short) 1);
+ @Test
+ public void assertUpdateShortForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateShort("label", (short) 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateIntForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateInt(1, 1);
+ @Test
+ public void assertUpdateIntForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateInt(1, 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateIntForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateInt("label", 1);
+ @Test
+ public void assertUpdateIntForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateInt("label", 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateLongForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateLong(1, 1L);
+ @Test
+ public void assertUpdateLongForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateLong(1, 1L));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateLongForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateLong("label", 1L);
+ @Test
+ public void assertUpdateLongForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateLong("label", 1L));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateFloatForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateFloat(1, 1.0F);
+ @Test
+ public void assertUpdateFloatForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateFloat(1, 1.0F));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateFloatForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateFloat("label", 1.0F);
+ @Test
+ public void assertUpdateFloatForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateFloat("label", 1.0F));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateDoubleForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateDouble(1, 1.0D);
+ @Test
+ public void assertUpdateDoubleForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateDouble(1, 1.0D));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateDoubleForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateDouble("label", 1.0D);
+ @Test
+ public void assertUpdateDoubleForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateDouble("label", 1.0D));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBigDecimalForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateBigDecimal(1, new BigDecimal("1"));
+ @Test
+ public void assertUpdateBigDecimalForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBigDecimal(1, new BigDecimal("1")));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBigDecimalForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateBigDecimal("label", new BigDecimal("1"));
+ @Test
+ public void assertUpdateBigDecimalForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBigDecimal("label", new BigDecimal("1")));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateStringForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateString(1, "1");
+ @Test
+ public void assertUpdateStringForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateString(1, "1"));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateStringForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateString("label", "1");
+ @Test
+ public void assertUpdateStringForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateString("label", "1"));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateNStringForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateNString(1, "");
+ @Test
+ public void assertUpdateNStringForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateNString(1, ""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateNStringForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateNString("label", "");
+ @Test
+ public void assertUpdateNStringForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateNString("label", ""));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBytesForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateBytes(1, new byte[]{});
+ @Test
+ public void assertUpdateBytesForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBytes(1, new byte[]{}));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBytesForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateBytes("label", new byte[]{});
+ @Test
+ public void assertUpdateBytesForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBytes("label", new byte[]{}));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateDateForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateDate(1, new Date(0L));
+ @Test
+ public void assertUpdateDateForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateDate(1, new Date(0L)));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateDateForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateDate("label", new Date(0L));
+ @Test
+ public void assertUpdateDateForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateDate("label", new Date(0L)));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateTimeForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateTime(1, new Time(0L));
+ @Test
+ public void assertUpdateTimeForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateTime(1, new Time(0L)));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateTimeForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateTime("label", new Time(0L));
+ @Test
+ public void assertUpdateTimeForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateTime("label", new Time(0L)));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateTimestampForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateTimestamp(1, new Timestamp(0L));
+ @Test
+ public void assertUpdateTimestampForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateTimestamp(1, new Timestamp(0L)));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateTimestampForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateTimestamp("label", new Timestamp(0L));
+ @Test
+ public void assertUpdateTimestampForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateTimestamp("label", new Timestamp(0L)));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateAsciiStreamForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateAsciiStream(1, System.in);
+ @Test
+ public void assertUpdateAsciiStreamForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateAsciiStream(1, System.in));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateAsciiStreamForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateAsciiStream("label", System.in);
+ @Test
+ public void assertUpdateAsciiStreamForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateAsciiStream("label", System.in));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateAsciiStreamForColumnIndexWithIntegerLength() throws SQLException {
- shardingSphereResultSet.updateAsciiStream(1, System.in, 1);
+ @Test
+ public void assertUpdateAsciiStreamForColumnIndexWithIntegerLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateAsciiStream(1, System.in, 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateAsciiStreamForColumnLabelWithIntegerLength() throws SQLException {
- shardingSphereResultSet.updateAsciiStream("label", System.in, 1);
+ @Test
+ public void assertUpdateAsciiStreamForColumnLabelWithIntegerLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateAsciiStream("label", System.in, 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateAsciiStreamForColumnIndexWithLongLength() throws SQLException {
- shardingSphereResultSet.updateAsciiStream(1, System.in, 1L);
+ @Test
+ public void assertUpdateAsciiStreamForColumnIndexWithLongLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateAsciiStream(1, System.in, 1L));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateAsciiStreamForColumnLabelWithLongLength() throws SQLException {
- shardingSphereResultSet.updateAsciiStream("label", System.in, 1L);
+ @Test
+ public void assertUpdateAsciiStreamForColumnLabelWithLongLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateAsciiStream("label", System.in, 1L));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBinaryStreamForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateBinaryStream(1, System.in);
+ @Test
+ public void assertUpdateBinaryStreamForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBinaryStream(1, System.in));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBinaryStreamForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateBinaryStream("label", System.in);
+ @Test
+ public void assertUpdateBinaryStreamForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBinaryStream("label", System.in));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBinaryStreamForColumnIndexWithIntegerLength() throws SQLException {
- shardingSphereResultSet.updateBinaryStream(1, System.in, 1);
+ @Test
+ public void assertUpdateBinaryStreamForColumnIndexWithIntegerLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBinaryStream(1, System.in, 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBinaryStreamForColumnLabelWithIntegerLength() throws SQLException {
- shardingSphereResultSet.updateBinaryStream("label", System.in, 1);
+ @Test
+ public void assertUpdateBinaryStreamForColumnLabelWithIntegerLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBinaryStream("label", System.in, 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBinaryStreamForColumnIndexWithLongLength() throws SQLException {
- shardingSphereResultSet.updateBinaryStream(1, System.in, 1L);
+ @Test
+ public void assertUpdateBinaryStreamForColumnIndexWithLongLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBinaryStream(1, System.in, 1L));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBinaryStreamForColumnLabelWithLongLength() throws SQLException {
- shardingSphereResultSet.updateBinaryStream("label", System.in, 1L);
+ @Test
+ public void assertUpdateBinaryStreamForColumnLabelWithLongLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBinaryStream("label", System.in, 1L));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateCharacterStreamForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateCharacterStream(1, new StringReader(""));
+ @Test
+ public void assertUpdateCharacterStreamForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateCharacterStream(1, new StringReader("")));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateCharacterStreamForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateCharacterStream("label", new StringReader(""));
+ @Test
+ public void assertUpdateCharacterStreamForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateCharacterStream("label", new StringReader("")));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateCharacterStreamForColumnIndexWithIntegerLength() throws SQLException {
- shardingSphereResultSet.updateCharacterStream(1, new StringReader(""), 1);
+ @Test
+ public void assertUpdateCharacterStreamForColumnIndexWithIntegerLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateCharacterStream(1, new StringReader(""), 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateCharacterStreamForColumnLabelWithIntegerLength() throws SQLException {
- shardingSphereResultSet.updateCharacterStream("label", new StringReader(""), 1);
+ @Test
+ public void assertUpdateCharacterStreamForColumnLabelWithIntegerLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateCharacterStream("label", new StringReader(""), 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateCharacterStreamForColumnIndexWithLongLength() throws SQLException {
- shardingSphereResultSet.updateCharacterStream(1, new StringReader(""), 1L);
+ @Test
+ public void assertUpdateCharacterStreamForColumnIndexWithLongLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateCharacterStream(1, new StringReader(""), 1L));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateCharacterStreamForColumnLabelWithLongLength() throws SQLException {
- shardingSphereResultSet.updateCharacterStream("label", new StringReader(""), 1L);
+ @Test
+ public void assertUpdateCharacterStreamForColumnLabelWithLongLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateCharacterStream("label", new StringReader(""), 1L));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateNCharacterStreamForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateNCharacterStream(1, new StringReader(""));
+ @Test
+ public void assertUpdateNCharacterStreamForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateNCharacterStream(1, new StringReader("")));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateNCharacterStreamForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateNCharacterStream("label", new StringReader(""));
+ @Test
+ public void assertUpdateNCharacterStreamForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateNCharacterStream("label", new StringReader("")));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateNCharacterStreamForColumnIndexWithLength() throws SQLException {
- shardingSphereResultSet.updateNCharacterStream(1, new StringReader(""), 1);
+ @Test
+ public void assertUpdateNCharacterStreamForColumnIndexWithLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateNCharacterStream(1, new StringReader(""), 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateNCharacterStreamForColumnLabelWithLength() throws SQLException {
- shardingSphereResultSet.updateNCharacterStream("label", new StringReader(""), 1);
+ @Test
+ public void assertUpdateNCharacterStreamForColumnLabelWithLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateNCharacterStream("label", new StringReader(""), 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateObjectForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateObject(1, new Object());
+ @Test
+ public void assertUpdateObjectForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateObject(1, new Object()));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateObjectForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateObject("label", new Object());
+ @Test
+ public void assertUpdateObjectForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateObject("label", new Object()));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateObjectForColumnIndexWithScaleOrLength() throws SQLException {
- shardingSphereResultSet.updateObject(1, new Object(), 1);
+ @Test
+ public void assertUpdateObjectForColumnIndexWithScaleOrLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateObject(1, new Object(), 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateObjectForColumnLabelWithScaleOrLength() throws SQLException {
- shardingSphereResultSet.updateObject("label", new Object(), 1);
+ @Test
+ public void assertUpdateObjectForColumnLabelWithScaleOrLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateObject("label", new Object(), 1));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateRefForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateRef(1, null);
+ @Test
+ public void assertUpdateRefForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateRef(1, null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateRefForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateRef("label", null);
+ @Test
+ public void assertUpdateRefForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateRef("label", null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBlobForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateBlob(1, (Blob) null);
+ @Test
+ public void assertUpdateBlobForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBlob(1, (Blob) null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBlobForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateBlob("label", (Blob) null);
+ @Test
+ public void assertUpdateBlobForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBlob("label", (Blob) null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBlobForColumnIndexWithInputStream() throws SQLException {
- shardingSphereResultSet.updateBlob(1, System.in);
+ @Test
+ public void assertUpdateBlobForColumnIndexWithInputStream() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBlob(1, System.in));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBlobForColumnLabelWithInputStream() throws SQLException {
- shardingSphereResultSet.updateBlob("label", System.in);
+ @Test
+ public void assertUpdateBlobForColumnLabelWithInputStream() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBlob("label", System.in));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBlobForColumnIndexWithInputStreamAndLength() throws SQLException {
- shardingSphereResultSet.updateBlob(1, System.in, 100);
+ @Test
+ public void assertUpdateBlobForColumnIndexWithInputStreamAndLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBlob(1, System.in, 100));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateBlobForColumnLabelWithInputStreamAndLength() throws SQLException {
- shardingSphereResultSet.updateBlob("label", System.in, 100);
+ @Test
+ public void assertUpdateBlobForColumnLabelWithInputStreamAndLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateBlob("label", System.in, 100));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateClobForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateClob(1, (Clob) null);
+ @Test
+ public void assertUpdateClobForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateClob(1, (Clob) null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateClobForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateClob("label", (Clob) null);
+ @Test
+ public void assertUpdateClobForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateClob("label", (Clob) null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateClobForColumnIndexWithInputStream() throws SQLException {
- shardingSphereResultSet.updateClob(1, new StringReader(""));
+ @Test
+ public void assertUpdateClobForColumnIndexWithInputStream() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateClob(1, new StringReader("")));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateClobForColumnLabelWithInputStream() throws SQLException {
- shardingSphereResultSet.updateClob("label", new StringReader(""));
+ @Test
+ public void assertUpdateClobForColumnLabelWithInputStream() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateClob("label", new StringReader("")));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateClobForColumnIndexWithInputStreamAndLength() throws SQLException {
- shardingSphereResultSet.updateClob(1, new StringReader(""), 100);
+ @Test
+ public void assertUpdateClobForColumnIndexWithInputStreamAndLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateClob(1, new StringReader(""), 100));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateClobForColumnLabelWithInputStreamAndLength() throws SQLException {
- shardingSphereResultSet.updateClob("label", new StringReader(""), 100);
+ @Test
+ public void assertUpdateClobForColumnLabelWithInputStreamAndLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateClob("label", new StringReader(""), 100));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateNClobForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateNClob(1, (NClob) null);
+ @Test
+ public void assertUpdateNClobForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateNClob(1, (NClob) null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateNClobForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateNClob("label", (NClob) null);
+ @Test
+ public void assertUpdateNClobForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateNClob("label", (NClob) null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateNClobForColumnIndexWithInputStream() throws SQLException {
- shardingSphereResultSet.updateNClob(1, new StringReader(""));
+ @Test
+ public void assertUpdateNClobForColumnIndexWithInputStream() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateNClob(1, new StringReader("")));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateNClobForColumnLabelWithInputStream() throws SQLException {
- shardingSphereResultSet.updateNClob("label", new StringReader(""));
+ @Test
+ public void assertUpdateNClobForColumnLabelWithInputStream() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateNClob("label", new StringReader("")));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateNClobForColumnIndexWithInputStreamAndLength() throws SQLException {
- shardingSphereResultSet.updateNClob(1, new StringReader(""), 100);
+ @Test
+ public void assertUpdateNClobForColumnIndexWithInputStreamAndLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateNClob(1, new StringReader(""), 100));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateNClobForColumnLabelWithInputStreamAndLength() throws SQLException {
- shardingSphereResultSet.updateNClob("label", new StringReader(""), 100);
+ @Test
+ public void assertUpdateNClobForColumnLabelWithInputStreamAndLength() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateNClob("label", new StringReader(""), 100));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateArrayForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateArray(1, null);
+ @Test
+ public void assertUpdateArrayForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateArray(1, null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateArrayForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateArray("label", null);
+ @Test
+ public void assertUpdateArrayForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateArray("label", null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateRowIdForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateRowId(1, null);
+ @Test
+ public void assertUpdateRowIdForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateRowId(1, null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateRowIdForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateRowId("label", null);
+ @Test
+ public void assertUpdateRowIdForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateRowId("label", null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateSQLXMLForColumnIndex() throws SQLException {
- shardingSphereResultSet.updateSQLXML(1, null);
+ @Test
+ public void assertUpdateSQLXMLForColumnIndex() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateSQLXML(1, null));
}
- @Test(expected = SQLFeatureNotSupportedException.class)
- public void assertUpdateSQXMLForColumnLabel() throws SQLException {
- shardingSphereResultSet.updateSQLXML("label", null);
+ @Test
+ public void assertUpdateSQXMLForColumnLabel() {
+ assertThrows(SQLFeatureNotSupportedException.class, () -> shardingSphereResultSet.updateSQLXML("label", null));
}
}