terrymanu commented on a change in pull request #4952: Add operations on 
cursors to EncryptResultSet(Suitable for a single data source) by 
originalResultSet
URL: 
https://github.com/apache/incubator-shardingsphere/pull/4952#discussion_r398687563
 
 

 ##########
 File path: 
sharding-jdbc/sharding-jdbc-core/src/test/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/resultset/EncryptResultSetTest.java
 ##########
 @@ -0,0 +1,32 @@
+package org.apache.shardingsphere.shardingjdbc.jdbc.core.resultset;
+
+import 
org.apache.shardingsphere.shardingjdbc.common.base.AbstractEncryptJDBCDatabaseAndTableTest;
+import org.junit.Test;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class EncryptResultSetTest extends 
AbstractEncryptJDBCDatabaseAndTableTest {
+
+    private static final String SELECT_SQL_TO_ASSERT = "SELECT id, cipher_pwd, 
plain_pwd FROM t_encrypt";
+
+    @Test
+    public void assertResultSetIsBeforeFirst() throws SQLException {
+        try (Statement statement = 
getEncryptConnection().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
+                ResultSet.CONCUR_READ_ONLY)) {
+            ResultSet resultSet = statement.executeQuery(SELECT_SQL_TO_ASSERT);
+            assertTrue(resultSet.isBeforeFirst());
+            resultSet.next();
+            assertEquals(1, resultSet.getRow());
+            resultSet.afterLast();
+            assertTrue(resultSet.isAfterLast());
+            resultSet.beforeFirst();
+            assertTrue(resultSet.isBeforeFirst());
 
 Review comment:
   This test method test more than one case, let's separate it to multiple 
methods.
   Just follow SRP.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to