You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by th...@apache.org on 2019/11/03 00:58:43 UTC

[commons-dbutils] branch master updated: Add coverage for static function to wrap ResultSet with null-checker

This is an automated email from the ASF dual-hosted git repository.

thecarlhall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbutils.git


The following commit(s) were added to refs/heads/master by this push:
     new 25d20ec  Add coverage for static function to wrap ResultSet with null-checker
25d20ec is described below

commit 25d20ecebd07b3a6cd267b99ef702f50833b4b76
Author: Carl Hall <th...@apache.org>
AuthorDate: Sat Nov 2 17:58:13 2019 -0700

    Add coverage for static function to wrap ResultSet with null-checker
---
 .../commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/test/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java b/src/test/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java
index 906bf8a..e39c21a 100644
--- a/src/test/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java
+++ b/src/test/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java
@@ -41,6 +41,9 @@ import java.util.Map;
 import org.apache.commons.dbutils.BaseTestCase;
 import org.apache.commons.dbutils.ProxyFactory;
 
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
 /**
  * Test cases for <code>SqlNullCheckedResultSet</code> class.
  */
@@ -811,6 +814,14 @@ public class SqlNullCheckedResultSetTest extends BaseTestCase {
         assertEquals(ts, rs.getTimestamp("column", Calendar.getInstance()));
     }
 
+    public void testWrapResultSet() throws SQLException {
+        ResultSet wrappedRs = mock(ResultSet.class);
+        ResultSet rs = SqlNullCheckedResultSet.wrap(wrappedRs);
+        rs.beforeFirst();
+        verify(wrappedRs).beforeFirst();
+        rs.next();
+        verify(wrappedRs).next();
+    }
 }
 
 class SqlNullUncheckedMockResultSet implements InvocationHandler {