You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2020/12/01 03:29:53 UTC
[shardingsphere] branch master updated: Add more test case for
JDBCQueryResultMetaData (#8428)
This is an automated email from the ASF dual-hosted git repository.
panjuan 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 a87d8e1 Add more test case for JDBCQueryResultMetaData (#8428)
a87d8e1 is described below
commit a87d8e17192df9dc8f2691e53854b61765478244
Author: wenweibin <41...@users.noreply.github.com>
AuthorDate: Tue Dec 1 11:29:27 2020 +0800
Add more test case for JDBCQueryResultMetaData (#8428)
---
.../jdbc/metadata/JDBCQueryResultMetaDataTest.java | 43 ++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/metadata/JDBCQueryResultMetaDataTest.java b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/metadata/JDBCQueryResultMetaDataTest.java
index 07a7a28..4d3901f 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/metadata/JDBCQueryResultMetaDataTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/metadata/JDBCQueryResultMetaDataTest.java
@@ -22,6 +22,7 @@ import org.junit.Test;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
+import java.sql.Types;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
@@ -43,6 +44,13 @@ public final class JDBCQueryResultMetaDataTest {
when(result.getColumnName(1)).thenReturn("order_id");
when(result.getColumnLabel(1)).thenReturn("oid");
when(result.getColumnTypeName(1)).thenReturn("INT");
+ when(result.getTableName(1)).thenReturn("order");
+ when(result.getColumnType(1)).thenReturn(Types.INTEGER);
+ when(result.getColumnDisplaySize(1)).thenReturn(10);
+ when(result.getScale(1)).thenReturn(0);
+ when(result.isSigned(1)).thenReturn(true);
+ when(result.isNullable(1)).thenReturn(ResultSetMetaData.columnNoNulls);
+ when(result.isAutoIncrement(1)).thenReturn(true);
return result;
}
@@ -65,4 +73,39 @@ public final class JDBCQueryResultMetaDataTest {
public void assertGetColumnTypeName() throws SQLException {
assertThat(queryResultMetaData.getColumnTypeName(1), is("INT"));
}
+
+ @Test
+ public void assertGetTableName() throws SQLException {
+ assertThat(queryResultMetaData.getTableName(1), is("order"));
+ }
+
+ @Test
+ public void assertGetColumnType() throws SQLException {
+ assertThat(queryResultMetaData.getColumnType(1), is(Types.INTEGER));
+ }
+
+ @Test
+ public void assertGetColumnLength() throws SQLException {
+ assertThat(queryResultMetaData.getColumnLength(1), is(10));
+ }
+
+ @Test
+ public void assertGetDecimals() throws SQLException {
+ assertThat(queryResultMetaData.getDecimals(1), is(0));
+ }
+
+ @Test
+ public void assertIsSigned() throws SQLException {
+ assertThat(queryResultMetaData.isSigned(1), is(true));
+ }
+
+ @Test
+ public void assertIsNotNull() throws SQLException {
+ assertThat(queryResultMetaData.isNotNull(1), is(true));
+ }
+
+ @Test
+ public void assertIsAutoIncrement() throws SQLException {
+ assertThat(queryResultMetaData.isAutoIncrement(1), is(true));
+ }
}