This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 39bbaef2863 Add AbstractUnsupportedOperationSQLFederationResultSetTest
(#37304)
39bbaef2863 is described below
commit 39bbaef28633f0d9a2326682eb2e7936d430beae
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Dec 9 10:15:11 2025 +0800
Add AbstractUnsupportedOperationSQLFederationResultSetTest (#37304)
* Add AbstractUnsupportedOperationSQLFederationResultSetTest
* Add AbstractUnsupportedOperationSQLFederationResultSetTest
* Add AbstractUnsupportedOperationSQLFederationResultSetTest
* Add AbstractUnsupportedOperationSQLFederationResultSetTest
* Add AbstractUnsupportedUpdateOperationSQLFederationResultSetTest
* Refactor SQLFederationResultSetTest
* Refactor SQLFederationResultSetTest
---
...pportedOperationSQLFederationResultSetTest.java | 285 ++++++++++
...dUpdateOperationSQLFederationResultSetTest.java | 619 +++++++++++++++++++++
.../resultset/SQLFederationResultSetTest.java | 115 +++-
3 files changed, 1013 insertions(+), 6 deletions(-)
diff --git
a/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSetTest.java
b/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSetTest.java
new file mode 100644
index 00000000000..cf1146ddfb5
--- /dev/null
+++
b/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSetTest.java
@@ -0,0 +1,285 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sqlfederation.resultset;
+
+import org.junit.jupiter.api.Test;
+
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.Collections;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.mockito.Mockito.CALLS_REAL_METHODS;
+import static org.mockito.Mockito.mock;
+
+@SuppressWarnings("resource")
+class AbstractUnsupportedOperationSQLFederationResultSetTest {
+
+ @Test
+ void assertPrevious() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).previous());
+ assertThat(ex.getMessage(), is("previous"));
+ }
+
+ @Test
+ void assertIsBeforeFirst() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).isBeforeFirst());
+ assertThat(ex.getMessage(), is("isBeforeFirst"));
+ }
+
+ @Test
+ void assertIsAfterLast() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).isAfterLast());
+ assertThat(ex.getMessage(), is("isAfterLast"));
+ }
+
+ @Test
+ void assertIsFirst() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).isFirst());
+ assertThat(ex.getMessage(), is("isFirst"));
+ }
+
+ @Test
+ void assertIsLast() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).isLast());
+ assertThat(ex.getMessage(), is("isLast"));
+ }
+
+ @Test
+ void assertBeforeFirst() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).beforeFirst());
+ assertThat(ex.getMessage(), is("beforeFirst"));
+ }
+
+ @Test
+ void assertAfterLast() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).afterLast());
+ assertThat(ex.getMessage(), is("afterLast"));
+ }
+
+ @Test
+ void assertFirst() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).first());
+ assertThat(ex.getMessage(), is("first"));
+ }
+
+ @Test
+ void assertLast() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).last());
+ assertThat(ex.getMessage(), is("last"));
+ }
+
+ @Test
+ void assertAbsolute() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).absolute(1));
+ assertThat(ex.getMessage(), is("absolute"));
+ }
+
+ @Test
+ void assertRelative() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).relative(1));
+ assertThat(ex.getMessage(), is("relative"));
+ }
+
+ @Test
+ void assertGetRow() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).getRow());
+ assertThat(ex.getMessage(), is("getRow"));
+ }
+
+ @Test
+ void assertInsertRow() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).insertRow());
+ assertThat(ex.getMessage(), is("insertRow"));
+ }
+
+ @Test
+ void assertUpdateRow() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateRow());
+ assertThat(ex.getMessage(), is("updateRow"));
+ }
+
+ @Test
+ void assertDeleteRow() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).deleteRow());
+ assertThat(ex.getMessage(), is("deleteRow"));
+ }
+
+ @Test
+ void assertRefreshRow() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).refreshRow());
+ assertThat(ex.getMessage(), is("refreshRow"));
+ }
+
+ @Test
+ void assertCancelRowUpdates() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).cancelRowUpdates());
+ assertThat(ex.getMessage(), is("cancelRowUpdates"));
+ }
+
+ @Test
+ void assertMoveToInsertRow() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).moveToInsertRow());
+ assertThat(ex.getMessage(), is("moveToInsertRow"));
+ }
+
+ @Test
+ void assertMoveToCurrentRow() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).moveToCurrentRow());
+ assertThat(ex.getMessage(), is("moveToCurrentRow"));
+ }
+
+ @Test
+ void assertRowInserted() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).rowInserted());
+ assertThat(ex.getMessage(), is("rowInserted"));
+ }
+
+ @Test
+ void assertRowUpdated() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).rowUpdated());
+ assertThat(ex.getMessage(), is("rowUpdated"));
+ }
+
+ @Test
+ void assertRowDeleted() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).rowDeleted());
+ assertThat(ex.getMessage(), is("rowDeleted"));
+ }
+
+ @Test
+ void assertGetCursorName() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).getCursorName());
+ assertThat(ex.getMessage(), is("getCursorName"));
+ }
+
+ @Test
+ void assertGetHoldability() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).getHoldability());
+ assertThat(ex.getMessage(), is("getHoldability"));
+ }
+
+ @Test
+ void assertGetNClobWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).getNClob(1));
+ assertThat(ex.getMessage(), is("getNClob"));
+ }
+
+ @Test
+ void assertGetNClobWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).getNClob("c"));
+ assertThat(ex.getMessage(), is("getNClob"));
+ }
+
+ @Test
+ void assertGetNCharacterStreamWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).getNCharacterStream(1));
+ assertThat(ex.getMessage(), is("getNCharacterStream"));
+ }
+
+ @Test
+ void assertGetNCharacterStreamWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).getNCharacterStream("c"));
+ assertThat(ex.getMessage(), is("getNCharacterStream"));
+ }
+
+ @Test
+ void assertGetRefWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).getRef(1));
+ assertThat(ex.getMessage(), is("getRef"));
+ }
+
+ @Test
+ void assertGetRefWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).getRef("c"));
+ assertThat(ex.getMessage(), is("getRef"));
+ }
+
+ @Test
+ void assertGetRowIdWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).getRowId(1));
+ assertThat(ex.getMessage(), is("getRowId"));
+ }
+
+ @Test
+ void assertGetRowIdWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).getRowId("c"));
+ assertThat(ex.getMessage(), is("getRowId"));
+ }
+
+ @Test
+ void assertGetObjectWithTypeByColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).getObject(1, Object.class));
+ assertThat(ex.getMessage(), is("getObject with type"));
+ }
+
+ @Test
+ void assertGetObjectWithTypeByColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).getObject("c", Object.class));
+ assertThat(ex.getMessage(), is("getObject with type"));
+ }
+
+ @Test
+ void assertGetObjectWithMapByColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).getObject("c", Collections.emptyMap()));
+ assertThat(ex.getMessage(), is("getObject with map"));
+ }
+
+ @Test
+ void assertGetObjectWithMapByColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).getObject(1, Collections.emptyMap()));
+ assertThat(ex.getMessage(), is("getObject with map"));
+ }
+}
diff --git
a/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedUpdateOperationSQLFederationResultSetTest.java
b/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedUpdateOperationSQLFederationResultSetTest.java
new file mode 100644
index 00000000000..a89424de6ee
--- /dev/null
+++
b/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedUpdateOperationSQLFederationResultSetTest.java
@@ -0,0 +1,619 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sqlfederation.resultset;
+
+import org.junit.jupiter.api.Test;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.Ref;
+import java.sql.RowId;
+import java.sql.SQLFeatureNotSupportedException;
+import java.sql.SQLXML;
+import java.sql.Time;
+import java.sql.Timestamp;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.mockito.Mockito.CALLS_REAL_METHODS;
+import static org.mockito.Mockito.mock;
+
+@SuppressWarnings("resource")
+class AbstractUnsupportedUpdateOperationSQLFederationResultSetTest {
+
+ @Test
+ void assertUpdateNullWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateNull(1));
+ assertThat(ex.getMessage(), is("updateNull"));
+ }
+
+ @Test
+ void assertUpdateNullWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateNull("c"));
+ assertThat(ex.getMessage(), is("updateNull"));
+ }
+
+ @Test
+ void assertUpdateBooleanWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBoolean(1, true));
+ assertThat(ex.getMessage(), is("updateBoolean"));
+ }
+
+ @Test
+ void assertUpdateBooleanWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBoolean("c", true));
+ assertThat(ex.getMessage(), is("updateBoolean"));
+ }
+
+ @Test
+ void assertUpdateByteWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateByte(1, (byte) 1));
+ assertThat(ex.getMessage(), is("updateByte"));
+ }
+
+ @Test
+ void assertUpdateByteWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateByte("c", (byte) 1));
+ assertThat(ex.getMessage(), is("updateByte"));
+ }
+
+ @Test
+ void assertUpdateShortWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateShort(1, (short) 1));
+ assertThat(ex.getMessage(), is("updateShort"));
+ }
+
+ @Test
+ void assertUpdateShortWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateShort("c", (short) 1));
+ assertThat(ex.getMessage(), is("updateShort"));
+ }
+
+ @Test
+ void assertUpdateIntWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateInt(1, 1));
+ assertThat(ex.getMessage(), is("updateInt"));
+ }
+
+ @Test
+ void assertUpdateIntWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateInt("c", 1));
+ assertThat(ex.getMessage(), is("updateInt"));
+ }
+
+ @Test
+ void assertUpdateLongWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateLong(1, 1L));
+ assertThat(ex.getMessage(), is("updateLong"));
+ }
+
+ @Test
+ void assertUpdateLongWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateLong("c", 1L));
+ assertThat(ex.getMessage(), is("updateLong"));
+ }
+
+ @Test
+ void assertUpdateFloatWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateFloat(1, 1F));
+ assertThat(ex.getMessage(), is("updateFloat"));
+ }
+
+ @Test
+ void assertUpdateFloatWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateFloat("c", 1F));
+ assertThat(ex.getMessage(), is("updateFloat"));
+ }
+
+ @Test
+ void assertUpdateDoubleWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateDouble(1, 1D));
+ assertThat(ex.getMessage(), is("updateDouble"));
+ }
+
+ @Test
+ void assertUpdateDoubleWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateDouble("c", 1D));
+ assertThat(ex.getMessage(), is("updateDouble"));
+ }
+
+ @Test
+ void assertUpdateBigDecimalWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBigDecimal(1, BigDecimal.ONE));
+ assertThat(ex.getMessage(), is("updateBigDecimal"));
+ }
+
+ @Test
+ void assertUpdateBigDecimalWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBigDecimal("c", BigDecimal.ONE));
+ assertThat(ex.getMessage(), is("updateBigDecimal"));
+ }
+
+ @Test
+ void assertUpdateStringWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateString(1, "v"));
+ assertThat(ex.getMessage(), is("updateString"));
+ }
+
+ @Test
+ void assertUpdateStringWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateString("c", "v"));
+ assertThat(ex.getMessage(), is("updateString"));
+ }
+
+ @Test
+ void assertUpdateNStringWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateNString(1, "v"));
+ assertThat(ex.getMessage(), is("updateNString"));
+ }
+
+ @Test
+ void assertUpdateNStringWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateNString("c", "v"));
+ assertThat(ex.getMessage(), is("updateNString"));
+ }
+
+ @Test
+ void assertUpdateBytesWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBytes(1, new byte[]{}));
+ assertThat(ex.getMessage(), is("updateBytes"));
+ }
+
+ @Test
+ void assertUpdateBytesWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBytes("c", new byte[]{}));
+ assertThat(ex.getMessage(), is("updateBytes"));
+ }
+
+ @Test
+ void assertUpdateDateWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateDate(1, mock(Date.class)));
+ assertThat(ex.getMessage(), is("updateDate"));
+ }
+
+ @Test
+ void assertUpdateDateWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateDate("c", mock(Date.class)));
+ assertThat(ex.getMessage(), is("updateDate"));
+ }
+
+ @Test
+ void assertUpdateTimeWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateTime(1, mock(Time.class)));
+ assertThat(ex.getMessage(), is("updateTime"));
+ }
+
+ @Test
+ void assertUpdateTimeWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateTime("c", mock(Time.class)));
+ assertThat(ex.getMessage(), is("updateTime"));
+ }
+
+ @Test
+ void assertUpdateTimestampWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateTimestamp(1, mock(Timestamp.class)));
+ assertThat(ex.getMessage(), is("updateTimestamp"));
+ }
+
+ @Test
+ void assertUpdateTimestampWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateTimestamp("c", mock(Timestamp.class)));
+ assertThat(ex.getMessage(), is("updateTimestamp"));
+ }
+
+ @Test
+ void assertUpdateAsciiStreamWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateAsciiStream(1, mock(InputStream.class)));
+ assertThat(ex.getMessage(), is("updateAsciiStream"));
+ }
+
+ @Test
+ void assertUpdateAsciiStreamWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateAsciiStream("c", mock(InputStream.class)));
+ assertThat(ex.getMessage(), is("updateAsciiStream"));
+ }
+
+ @Test
+ void assertUpdateAsciiStreamWithLengthByIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateAsciiStream(1, mock(InputStream.class), 1));
+ assertThat(ex.getMessage(), is("updateAsciiStream"));
+ }
+
+ @Test
+ void assertUpdateAsciiStreamWithLengthByLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateAsciiStream("c", mock(InputStream.class), 1));
+ assertThat(ex.getMessage(), is("updateAsciiStream"));
+ }
+
+ @Test
+ void assertUpdateAsciiStreamWithLongLengthByIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateAsciiStream(1, mock(InputStream.class), 1L));
+ assertThat(ex.getMessage(), is("updateAsciiStream"));
+ }
+
+ @Test
+ void assertUpdateAsciiStreamWithLongLengthByLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateAsciiStream("c", mock(InputStream.class), 1L));
+ assertThat(ex.getMessage(), is("updateAsciiStream"));
+ }
+
+ @Test
+ void assertUpdateBinaryStreamWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBinaryStream(1, mock(InputStream.class)));
+ assertThat(ex.getMessage(), is("updateBinaryStream"));
+ }
+
+ @Test
+ void assertUpdateBinaryStreamWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBinaryStream("c", mock(InputStream.class)));
+ assertThat(ex.getMessage(), is("updateBinaryStream"));
+ }
+
+ @Test
+ void assertUpdateBinaryStreamWithLengthByIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBinaryStream(1, mock(InputStream.class), 1));
+ assertThat(ex.getMessage(), is("updateBinaryStream"));
+ }
+
+ @Test
+ void assertUpdateBinaryStreamWithLengthByLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBinaryStream("c", mock(InputStream.class), 1));
+ assertThat(ex.getMessage(), is("updateBinaryStream"));
+ }
+
+ @Test
+ void assertUpdateBinaryStreamWithLongLengthByIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBinaryStream(1, mock(InputStream.class), 1L));
+ assertThat(ex.getMessage(), is("updateBinaryStream"));
+ }
+
+ @Test
+ void assertUpdateBinaryStreamWithLongLengthByLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBinaryStream("c", mock(InputStream.class), 1L));
+ assertThat(ex.getMessage(), is("updateBinaryStream"));
+ }
+
+ @Test
+ void assertUpdateCharacterStreamWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateCharacterStream(1, mock(Reader.class)));
+ assertThat(ex.getMessage(), is("updateCharacterStream"));
+ }
+
+ @Test
+ void assertUpdateCharacterStreamWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateCharacterStream("c", mock(Reader.class)));
+ assertThat(ex.getMessage(), is("updateCharacterStream"));
+ }
+
+ @Test
+ void assertUpdateCharacterStreamWithLengthByIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateCharacterStream(1, mock(Reader.class), 1));
+ assertThat(ex.getMessage(), is("updateCharacterStream"));
+ }
+
+ @Test
+ void assertUpdateCharacterStreamWithLengthByLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateCharacterStream("c", mock(Reader.class), 1));
+ assertThat(ex.getMessage(), is("updateCharacterStream"));
+ }
+
+ @Test
+ void assertUpdateCharacterStreamWithLongLengthByIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateCharacterStream(1, mock(Reader.class), 1L));
+ assertThat(ex.getMessage(), is("updateCharacterStream"));
+ }
+
+ @Test
+ void assertUpdateCharacterStreamWithLongLengthByLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateCharacterStream("c", mock(Reader.class), 1L));
+ assertThat(ex.getMessage(), is("updateCharacterStream"));
+ }
+
+ @Test
+ void assertUpdateNCharacterStreamWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateNCharacterStream(1, mock(Reader.class)));
+ assertThat(ex.getMessage(), is("updateNCharacterStream"));
+ }
+
+ @Test
+ void assertUpdateNCharacterStreamWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateNCharacterStream("c", mock(Reader.class)));
+ assertThat(ex.getMessage(), is("updateNCharacterStream"));
+ }
+
+ @Test
+ void assertUpdateNCharacterStreamWithLongLengthByIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateNCharacterStream(1, mock(Reader.class), 1L));
+ assertThat(ex.getMessage(), is("updateNCharacterStream"));
+ }
+
+ @Test
+ void assertUpdateNCharacterStreamWithLongLengthByLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateNCharacterStream("c", mock(Reader.class), 1L));
+ assertThat(ex.getMessage(), is("updateNCharacterStream"));
+ }
+
+ @Test
+ void assertUpdateObjectWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateObject(1, new Object()));
+ assertThat(ex.getMessage(), is("updateObject"));
+ }
+
+ @Test
+ void assertUpdateObjectWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateObject("c", new Object()));
+ assertThat(ex.getMessage(), is("updateObject"));
+ }
+
+ @Test
+ void assertUpdateObjectWithScaleByIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateObject(1, new Object(), 1));
+ assertThat(ex.getMessage(), is("updateObject"));
+ }
+
+ @Test
+ void assertUpdateObjectWithScaleByLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateObject("c", new Object(), 1));
+ assertThat(ex.getMessage(), is("updateObject"));
+ }
+
+ @Test
+ void assertUpdateRefWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateRef(1, mock(Ref.class)));
+ assertThat(ex.getMessage(), is("updateRef"));
+ }
+
+ @Test
+ void assertUpdateRefWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateRef("c", mock(Ref.class)));
+ assertThat(ex.getMessage(), is("updateRef"));
+ }
+
+ @Test
+ void assertUpdateBlobWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBlob(1, mock(Blob.class)));
+ assertThat(ex.getMessage(), is("updateBlob"));
+ }
+
+ @Test
+ void assertUpdateBlobWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBlob("c", mock(Blob.class)));
+ assertThat(ex.getMessage(), is("updateBlob"));
+ }
+
+ @Test
+ void assertUpdateBlobWithStreamByIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBlob(1, mock(InputStream.class)));
+ assertThat(ex.getMessage(), is("updateBlob"));
+ }
+
+ @Test
+ void assertUpdateBlobWithStreamByLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBlob("c", mock(InputStream.class)));
+ assertThat(ex.getMessage(), is("updateBlob"));
+ }
+
+ @Test
+ void assertUpdateBlobWithLongLengthByIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBlob(1, mock(InputStream.class), 1L));
+ assertThat(ex.getMessage(), is("updateBlob"));
+ }
+
+ @Test
+ void assertUpdateBlobWithLongLengthByLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateBlob("c", mock(InputStream.class), 1L));
+ assertThat(ex.getMessage(), is("updateBlob"));
+ }
+
+ @Test
+ void assertUpdateClobWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateClob(1, mock(Clob.class)));
+ assertThat(ex.getMessage(), is("updateClob"));
+ }
+
+ @Test
+ void assertUpdateClobWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateClob("c", mock(Clob.class)));
+ assertThat(ex.getMessage(), is("updateClob"));
+ }
+
+ @Test
+ void assertUpdateClobWithReaderByIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateClob(1, mock(Reader.class)));
+ assertThat(ex.getMessage(), is("updateClob"));
+ }
+
+ @Test
+ void assertUpdateClobWithReaderByLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateClob("c", mock(Reader.class)));
+ assertThat(ex.getMessage(), is("updateClob"));
+ }
+
+ @Test
+ void assertUpdateClobWithLongLengthByIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateClob(1, mock(Reader.class), 1L));
+ assertThat(ex.getMessage(), is("updateClob"));
+ }
+
+ @Test
+ void assertUpdateClobWithLongLengthByLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateClob("c", mock(Reader.class), 1L));
+ assertThat(ex.getMessage(), is("updateClob"));
+ }
+
+ @Test
+ void assertUpdateNClobWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateNClob(1, mock(NClob.class)));
+ assertThat(ex.getMessage(), is("updateNClob"));
+ }
+
+ @Test
+ void assertUpdateNClobWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateNClob("c", mock(NClob.class)));
+ assertThat(ex.getMessage(), is("updateNClob"));
+ }
+
+ @Test
+ void assertUpdateNClobWithReaderByIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateNClob(1, mock(Reader.class)));
+ assertThat(ex.getMessage(), is("updateNClob"));
+ }
+
+ @Test
+ void assertUpdateNClobWithReaderByLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateNClob("c", mock(Reader.class)));
+ assertThat(ex.getMessage(), is("updateNClob"));
+ }
+
+ @Test
+ void assertUpdateNClobWithLongLengthByIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateNClob(1, mock(Reader.class), 1L));
+ assertThat(ex.getMessage(), is("updateNClob"));
+ }
+
+ @Test
+ void assertUpdateNClobWithLongLengthByLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateNClob("c", mock(Reader.class), 1L));
+ assertThat(ex.getMessage(), is("updateNClob"));
+ }
+
+ @Test
+ void assertUpdateArrayWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateArray(1, mock(Array.class)));
+ assertThat(ex.getMessage(), is("updateArray"));
+ }
+
+ @Test
+ void assertUpdateArrayWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateArray("c", mock(Array.class)));
+ assertThat(ex.getMessage(), is("updateArray"));
+ }
+
+ @Test
+ void assertUpdateRowIdWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateRowId(1, mock(RowId.class)));
+ assertThat(ex.getMessage(), is("updateRowId"));
+ }
+
+ @Test
+ void assertUpdateRowIdWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateRowId("c", mock(RowId.class)));
+ assertThat(ex.getMessage(), is("updateRowId"));
+ }
+
+ @Test
+ void assertUpdateSQLXMLWithColumnIndex() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateSQLXML(1, mock(SQLXML.class)));
+ assertThat(ex.getMessage(), is("updateSQLXML"));
+ }
+
+ @Test
+ void assertUpdateSQLXMLWithColumnLabel() {
+ SQLFeatureNotSupportedException ex =
assertThrows(SQLFeatureNotSupportedException.class,
+ () ->
mock(AbstractUnsupportedOperationSQLFederationResultSet.class,
CALLS_REAL_METHODS).updateSQLXML("c", mock(SQLXML.class)));
+ assertThat(ex.getMessage(), is("updateSQLXML"));
+ }
+}
diff --git
a/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSetTest.java
b/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSetTest.java
index 8199505155a..071dac10595 100644
---
a/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSetTest.java
+++
b/kernel/sql-federation/core/src/test/java/org/apache/shardingsphere/sqlfederation/resultset/SQLFederationResultSetTest.java
@@ -37,11 +37,15 @@ import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
+import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
+import java.sql.SQLWarning;
import java.sql.SQLXML;
+import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
+import java.sql.ResultSetMetaData;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
@@ -57,6 +61,8 @@ import static org.mockito.Mockito.when;
class SQLFederationResultSetTest {
+ private final DatabaseType databaseType =
TypedSPILoader.getService(DatabaseType.class, "FIXTURE");
+
private Enumerator<Object> enumerator;
private SQLFederationResultSet federationResultSet;
@@ -64,15 +70,14 @@ class SQLFederationResultSetTest {
@BeforeEach
void setUp() {
enumerator = createEnumerator();
- federationResultSet =
- new SQLFederationResultSet(enumerator,
mock(SQLFederationSchema.class), createExpandProjections(),
TypedSPILoader.getService(DatabaseType.class, "FIXTURE"),
mock(RelDataType.class),
- "1");
+ federationResultSet = new SQLFederationResultSet(enumerator,
mock(SQLFederationSchema.class), createExpandProjections(), databaseType,
mock(RelDataType.class), "1");
}
private List<Projection> createExpandProjections() {
- return Arrays.asList(new ColumnProjection("o", "order_id", null,
mock(DatabaseType.class)), new ColumnProjection("o", "user_id", null,
mock(DatabaseType.class)),
- new ColumnProjection("o", "status", null,
mock(DatabaseType.class)),
- new ColumnProjection("i", "item_id", null,
mock(DatabaseType.class)));
+ return Arrays.asList(new ColumnProjection("o", "order_id", null,
databaseType),
+ new ColumnProjection("o", "user_id", null, databaseType),
+ new ColumnProjection("o", "status", null, databaseType),
+ new ColumnProjection("i", "item_id", null, databaseType));
}
@SuppressWarnings("unchecked")
@@ -94,6 +99,49 @@ class SQLFederationResultSetTest {
assertTrue(federationResultSet.next());
}
+ @SuppressWarnings("unchecked")
+ @Test
+ void assertNextThrowsWillCloseAndRethrow() {
+ Enumerator<Object> throwingEnumerator = mock(Enumerator.class);
+
when(throwingEnumerator.moveNext()).thenThrow(IllegalStateException.class);
+ SQLFederationResultSet resultSet = new
SQLFederationResultSet(throwingEnumerator, mock(SQLFederationSchema.class),
createExpandProjections(), databaseType, mock(RelDataType.class), "p");
+ assertThrows(IllegalStateException.class, resultSet::next);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ void assertNextReturnsFalseWillCompleteProcess() {
+ enumerator = mock(Enumerator.class);
+ federationResultSet = new SQLFederationResultSet(enumerator,
mock(SQLFederationSchema.class), createExpandProjections(), databaseType,
mock(RelDataType.class), "p");
+ assertFalse(federationResultSet.next());
+ }
+
+ @Test
+ void assertNextHandlesNullCurrent() throws SQLException {
+ when(enumerator.current()).thenReturn(null);
+ when(enumerator.moveNext()).thenReturn(true, false);
+ assertTrue(federationResultSet.next());
+ federationResultSet.getObject(1);
+ assertTrue(federationResultSet.wasNull());
+ }
+
+ @Test
+ void assertNextHandlesSingleNonArrayValue() throws SQLException {
+ when(enumerator.current()).thenReturn("val");
+ when(enumerator.moveNext()).thenReturn(true, false);
+ assertTrue(federationResultSet.next());
+ assertThat(federationResultSet.getString(1), is("val"));
+ }
+
+ @Test
+ void assertNextHandlesByteArrayValue() throws SQLException {
+ byte[] bytes = new byte[]{1, 2};
+ when(enumerator.current()).thenReturn(bytes);
+ when(enumerator.moveNext()).thenReturn(true, false);
+ assertTrue(federationResultSet.next());
+ assertThat(federationResultSet.getBytes(1), is(bytes));
+ }
+
@Test
void assertWasNull() {
assertFalse(federationResultSet.wasNull());
@@ -456,6 +504,14 @@ class SQLFederationResultSetTest {
assertThat(federationResultSet.getArray("order_id"), isA(Array.class));
}
+ @Test
+ void assertGetArrayNullSetsWasNull() throws SQLException {
+ when(enumerator.current()).thenReturn(new Object[]{null, 1, "OK", 1});
+ federationResultSet.next();
+ federationResultSet.getArray(1);
+ assertTrue(federationResultSet.wasNull());
+ }
+
@Test
void assertGetURLWithColumnIndex() throws SQLException,
MalformedURLException {
when(enumerator.current()).thenReturn(new Object[]{new
URL("http://xxx.xxx"), 1, "OK", 1});
@@ -483,4 +539,51 @@ class SQLFederationResultSetTest {
federationResultSet.next();
assertThrows(SQLFeatureNotSupportedException.class, () ->
federationResultSet.getSQLXML("order_id"));
}
+
+ @Test
+ void assertFindColumnNotFoundThrows() {
+ assertThrows(SQLFeatureNotSupportedException.class, () ->
federationResultSet.findColumn("missing"));
+ }
+
+ @Test
+ void assertClearAndWarningsAndFetch() {
+ federationResultSet.clearWarnings();
+ assertThat(federationResultSet.getWarnings(), is((SQLWarning) null));
+ federationResultSet.setFetchDirection(ResultSet.FETCH_REVERSE);
+ assertThat(federationResultSet.getFetchDirection(),
is(ResultSet.FETCH_FORWARD));
+ federationResultSet.setFetchSize(10);
+ assertThat(federationResultSet.getFetchSize(), is(0));
+ }
+
+ @Test
+ void assertTypeConcurrencyStatementAndClosed() {
+ assertThat(federationResultSet.getType(),
is(ResultSet.TYPE_FORWARD_ONLY));
+ assertThat(federationResultSet.getConcurrency(),
is(ResultSet.CONCUR_READ_ONLY));
+ assertThat(federationResultSet.getStatement(), is((Statement) null));
+ assertFalse(federationResultSet.isClosed());
+ federationResultSet.close();
+ assertTrue(federationResultSet.isClosed());
+ }
+
+ @Test
+ void assertGetMetaData() {
+ assertThat(federationResultSet.getMetaData(),
isA(ResultSetMetaData.class));
+ }
+
+ @Test
+ void assertGetObjectWithIndexAndLabel() throws SQLException {
+ when(enumerator.current()).thenReturn(new Object[]{10, 1, "OK", 1});
+ federationResultSet.next();
+ assertThat(federationResultSet.getObject(1), is(10));
+ assertFalse(federationResultSet.wasNull());
+ assertThat(federationResultSet.getObject("order_id"), is(10));
+ }
+
+ @Test
+ void assertGetCalendarValueNullSetsWasNull() throws SQLException {
+ when(enumerator.current()).thenReturn(new Object[]{null, 1, "OK", 1});
+ federationResultSet.next();
+ assertThat(federationResultSet.getDate(1, Calendar.getInstance()),
is((Date) null));
+ assertTrue(federationResultSet.wasNull());
+ }
}