You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2018/07/03 23:56:10 UTC

[1/5] commons-dbcp git commit: [DBCP-504] Increase test coverage. Closes #13.

Repository: commons-dbcp
Updated Branches:
  refs/heads/master 629040340 -> 64a13ee39


http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/managed/TestLocalXaResource.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestLocalXaResource.java b/src/test/java/org/apache/commons/dbcp2/managed/TestLocalXaResource.java
new file mode 100644
index 0000000..7efe5ca
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbcp2/managed/TestLocalXaResource.java
@@ -0,0 +1,590 @@
+/*
+ *
+ * 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.commons.dbcp2.managed;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.NClob;
+import java.sql.PreparedStatement;
+import java.sql.SQLClientInfoException;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Savepoint;
+import java.sql.Statement;
+import java.sql.Struct;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.Executor;
+
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests for LocalXAConnectionFactory$LocalXAResource
+ */
+public class TestLocalXaResource {
+
+    private Connection conn;
+    private LocalXAConnectionFactory.LocalXAResource resource;
+
+    @Before
+    public void setUp() {
+        conn = new TestConnection();
+        resource = new LocalXAConnectionFactory.LocalXAResource(conn);
+    }
+
+    @Test
+    public void testConstructor() {
+        assertEquals(0, resource.getTransactionTimeout());
+        assertNull(resource.getXid());
+        // the current implementation always return false, regardless of the input value
+        assertFalse(resource.setTransactionTimeout(100));
+        // the current implementation always return an empty/zero'd array, regardless of the input value
+        assertEquals(0, resource.recover(100).length);
+    }
+
+    @Test
+    public void testIsSame() {
+        assertTrue(resource.isSameRM(resource));
+        assertFalse(resource.isSameRM(new LocalXAConnectionFactory.LocalXAResource(conn)));
+    }
+
+    @Test(expected=XAException.class)
+    public void testStartInvalidFlag() throws XAException {
+        // currently, valid values are TMNOFLAGS and TMRESUME
+        resource.start(null, XAResource.TMENDRSCAN);
+    }
+
+    @Test(expected=XAException.class)
+    public void testStartNoFlagButAlreadyEnlisted() throws XAException {
+        resource.start(new TestXid(), XAResource.TMNOFLAGS);
+        resource.start(new TestXid(), XAResource.TMNOFLAGS);
+    }
+
+    @Test(expected=XAException.class)
+    public void testStartNoFlagResumeButDifferentXid() throws XAException {
+        resource.start(new TestXid(), XAResource.TMNOFLAGS);
+        resource.start(new TestXid(), XAResource.TMRESUME);
+    }
+
+    @Test
+    public void testStartNoFlagResume() throws XAException {
+        Xid xid = new TestXid();
+        resource.start(xid, XAResource.TMNOFLAGS);
+        resource.start(xid, XAResource.TMRESUME);
+        assertEquals(xid, resource.getXid());
+    }
+
+    @Test
+    public void testStartNoFlagResumeEnd() throws XAException {
+        Xid xid = new TestXid();
+        resource.start(xid, XAResource.TMNOFLAGS);
+        resource.start(xid, XAResource.TMRESUME);
+        // flag is never used in the end
+        resource.end(xid, 0);
+        assertEquals(xid, resource.getXid());
+    }
+
+    @Test(expected=NullPointerException.class)
+    public void testStartNoFlagResumeEndMissingXid() throws XAException {
+        Xid xid = new TestXid();
+        resource.start(xid, XAResource.TMNOFLAGS);
+        resource.start(xid, XAResource.TMRESUME);
+        // flag is never used in the end
+        resource.end(null, 0);
+    }
+
+    @Test(expected=XAException.class)
+    public void testStartNoFlagResumeEndDifferentXid() throws XAException {
+        Xid xid = new TestXid();
+        resource.start(xid, XAResource.TMNOFLAGS);
+        resource.start(xid, XAResource.TMRESUME);
+        // flag is never used in the end
+        resource.end(new TestXid(), 0);
+    }
+
+    @Test
+    public void testForgetDifferentXid() throws XAException {
+        Xid xid = new TestXid();
+        resource.start(xid, XAResource.TMNOFLAGS);
+        resource.forget(new TestXid());
+        assertEquals(xid, resource.getXid());
+    }
+
+    @Test
+    public void testForgetMissingXid() throws XAException {
+        Xid xid = new TestXid();
+        resource.start(xid, XAResource.TMNOFLAGS);
+        resource.forget(null);
+        assertEquals(xid, resource.getXid());
+    }
+
+    @Test
+    public void testForget() throws XAException {
+        Xid xid = new TestXid();
+        resource.start(xid, XAResource.TMNOFLAGS);
+        resource.forget(xid);
+        assertNull(resource.getXid());
+    }
+
+    @Test
+    public void testStartReadOnlyConnectionPrepare() throws XAException, SQLException {
+        Xid xid = new TestXid();
+        conn.setAutoCommit(false);
+        conn.setReadOnly(true);
+        resource.start(xid, XAResource.TMNOFLAGS);
+        resource.prepare(xid);
+        assertFalse(conn.getAutoCommit());
+    }
+
+    /**
+     * When an exception is thrown on the {@link Connection#getAutoCommit()}, then the
+     * value is set to {@code true} by default.
+     * @throws XAException when there are errors with the transaction
+     * @throws SQLException when there are errors with other SQL/DB parts
+     */
+    @Test
+    public void testStartExceptionOnGetAutoCommit() throws XAException, SQLException {
+        Xid xid = new TestXid();
+        ((TestConnection) conn).throwWhenGetAutoCommit = true;
+        conn.setAutoCommit(false);
+        conn.setReadOnly(true);
+        // the start method with no flag will call getAutoCommit, the exception will be thrown, and it will be set
+        // to true
+        resource.start(xid, XAResource.TMNOFLAGS);
+        // and prepare sets the value computed in start in the connection
+        resource.prepare(xid);
+        ((TestConnection) conn).throwWhenGetAutoCommit = false;
+        assertTrue(conn.getAutoCommit());
+    }
+
+    /**
+     * When an exception is thrown on the {@link Connection#getAutoCommit()}, then the
+     * value is set to {@code true} by default. However, if the connection is not read-only,
+     * then the value set by the user in the original connection will be kept.
+     * @throws XAException when there are errors with the transaction
+     * @throws SQLException when there are errors with other SQL/DB parts
+     */
+    @Test
+    public void testStartReadOnlyConnectionExceptionOnGetAutoCommit() throws XAException, SQLException {
+        Xid xid = new TestXid();
+        ((TestConnection) conn).throwWhenGetAutoCommit = true;
+        conn.setAutoCommit(false);
+        conn.setReadOnly(false);
+        // the start method with no flag will call getAutoCommit, the exception will be thrown, and it will be set
+        // to true
+        resource.start(xid, XAResource.TMNOFLAGS);
+        // and prepare sets the value computed in start in the connection
+        resource.prepare(xid);
+        ((TestConnection) conn).throwWhenGetAutoCommit = false;
+        assertFalse(conn.getAutoCommit());
+    }
+
+    @Test(expected=XAException.class)
+    public void testStartFailsWhenCannotSetAutoCommit() throws XAException, SQLException {
+        Xid xid = new TestXid();
+        ((TestConnection) conn).throwWhenSetAutoCommit = true;
+        resource.start(xid, XAResource.TMNOFLAGS);
+    }
+
+    @Test(expected=NullPointerException.class)
+    public void testCommitMissingXid() throws SQLException, XAException {
+        resource.commit(null, false);
+    }
+
+    @Test(expected=XAException.class)
+    public void testCommitNoTransaction() throws SQLException, XAException {
+        ((TestConnection) conn).closed = false;
+        conn.setReadOnly(false);
+        resource.commit(new TestXid(), false);
+    }
+
+    @Test(expected=XAException.class)
+    public void testCommitInvalidXid() throws SQLException, XAException {
+        Xid xid = new TestXid();
+        ((TestConnection) conn).closed = false;
+        conn.setReadOnly(false);
+        resource.start(xid, XAResource.TMNOFLAGS);
+        resource.commit(new TestXid(), false);
+    }
+
+    @Test(expected=XAException.class)
+    public void testCommitConnectionClosed() throws SQLException, XAException {
+        Xid xid = new TestXid();
+        ((TestConnection) conn).closed = true;
+        conn.setReadOnly(false);
+        resource.start(xid, XAResource.TMNOFLAGS);
+        resource.commit(xid, false);
+    }
+
+    @Test
+    public void testCommitConnectionNotReadOnly() throws SQLException, XAException {
+        Xid xid = new TestXid();
+        ((TestConnection) conn).closed = false;
+        conn.setReadOnly(true);
+        resource.start(xid, XAResource.TMNOFLAGS);
+        resource.commit(xid, false);
+        assertFalse(((TestConnection) conn).committed);
+    }
+
+    @Test
+    public void testCommit() throws SQLException, XAException {
+        Xid xid = new TestXid();
+        ((TestConnection) conn).closed = false;
+        conn.setReadOnly(false);
+        resource.start(xid, XAResource.TMNOFLAGS);
+        resource.commit(xid, false);
+        assertTrue(((TestConnection) conn).committed);
+    }
+
+    @Test(expected=NullPointerException.class)
+    public void testRollbackMissingXid() throws XAException {
+        resource.rollback(null);
+    }
+
+    @Test(expected=XAException.class)
+    public void testRollbackInvalidXid() throws SQLException, XAException {
+        Xid xid = new TestXid();
+        ((TestConnection) conn).closed = false;
+        conn.setReadOnly(false);
+        resource.start(xid, XAResource.TMNOFLAGS);
+        resource.rollback(new TestXid());
+    }
+
+    @Test
+    public void testRollback() throws SQLException, XAException {
+        Xid xid = new TestXid();
+        ((TestConnection) conn).closed = false;
+        conn.setReadOnly(false);
+        resource.start(xid, XAResource.TMNOFLAGS);
+        resource.rollback(xid);
+        assertTrue(((TestConnection) conn).rolledback);
+    }
+
+    private static class TestConnection implements Connection {
+
+        public boolean throwWhenGetAutoCommit = false;
+        public boolean throwWhenSetAutoCommit = false;
+        boolean autoCommit = false;
+        boolean readOnly = false;
+        public boolean committed = false;
+        public boolean rolledback = false;
+        public boolean closed = false;
+
+        @Override
+        public <T> T unwrap(Class<T> iface) throws SQLException {
+            return null;
+        }
+
+        @Override
+        public boolean isWrapperFor(Class<?> iface) throws SQLException {
+            return false;
+        }
+
+        @Override
+        public Statement createStatement() throws SQLException {
+            return null;
+        }
+
+        @Override
+        public PreparedStatement prepareStatement(String sql) throws SQLException {
+            return null;
+        }
+
+        @Override
+        public CallableStatement prepareCall(String sql) throws SQLException {
+            return null;
+        }
+
+        @Override
+        public String nativeSQL(String sql) throws SQLException {
+            return null;
+        }
+
+        @Override
+        public void setAutoCommit(boolean autoCommit) throws SQLException {
+            if (throwWhenSetAutoCommit) {
+                throw new SQLException();
+            }
+            this.autoCommit = autoCommit;
+        }
+
+        @Override
+        public boolean getAutoCommit() throws SQLException {
+            if (throwWhenGetAutoCommit) {
+                throw new SQLException();
+            }
+            return autoCommit;
+        }
+
+        @Override
+        public void commit() throws SQLException {
+            committed = true;
+        }
+
+        @Override
+        public void rollback() throws SQLException {
+            rolledback = true;
+        }
+
+        @Override
+        public void close() throws SQLException {
+            closed = true;
+        }
+
+        @Override
+        public boolean isClosed() throws SQLException {
+            return closed;
+        }
+
+        @Override
+        public DatabaseMetaData getMetaData() throws SQLException {
+            return null;
+        }
+
+        @Override
+        public void setReadOnly(boolean readOnly) throws SQLException {
+            this.readOnly = readOnly;
+        }
+
+        @Override
+        public boolean isReadOnly() throws SQLException {
+            return readOnly;
+        }
+
+        @Override
+        public void setCatalog(String catalog) throws SQLException {
+        }
+
+        @Override
+        public String getCatalog() throws SQLException {
+            return null;
+        }
+
+        @Override
+        public void setTransactionIsolation(int level) throws SQLException {
+        }
+
+        @Override
+        public int getTransactionIsolation() throws SQLException {
+            return 0;
+        }
+
+        @Override
+        public SQLWarning getWarnings() throws SQLException {
+            return null;
+        }
+
+        @Override
+        public void clearWarnings() throws SQLException {
+        }
+
+        @Override
+        public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
+            return null;
+        }
+
+        @Override
+        public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
+                throws SQLException {
+            return null;
+        }
+
+        @Override
+        public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency)
+                throws SQLException {
+            return null;
+        }
+
+        @Override
+        public Map<String, Class<?>> getTypeMap() throws SQLException {
+            return null;
+        }
+
+        @Override
+        public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
+        }
+
+        @Override
+        public void setHoldability(int holdability) throws SQLException {
+        }
+
+        @Override
+        public int getHoldability() throws SQLException {
+            return 0;
+        }
+
+        @Override
+        public Savepoint setSavepoint() throws SQLException {
+            return null;
+        }
+
+        @Override
+        public Savepoint setSavepoint(String name) throws SQLException {
+            return null;
+        }
+
+        @Override
+        public void rollback(Savepoint savepoint) throws SQLException {
+        }
+
+        @Override
+        public void releaseSavepoint(Savepoint savepoint) throws SQLException {
+        }
+
+        @Override
+        public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
+                throws SQLException {
+            return null;
+        }
+
+        @Override
+        public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency,
+                int resultSetHoldability) throws SQLException {
+            return null;
+        }
+
+        @Override
+        public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency,
+                int resultSetHoldability) throws SQLException {
+            return null;
+        }
+
+        @Override
+        public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
+            return null;
+        }
+
+        @Override
+        public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
+            return null;
+        }
+
+        @Override
+        public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
+            return null;
+        }
+
+        @Override
+        public Clob createClob() throws SQLException {
+            return null;
+        }
+
+        @Override
+        public Blob createBlob() throws SQLException {
+            return null;
+        }
+
+        @Override
+        public NClob createNClob() throws SQLException {
+            return null;
+        }
+
+        @Override
+        public SQLXML createSQLXML() throws SQLException {
+            return null;
+        }
+
+        @Override
+        public boolean isValid(int timeout) throws SQLException {
+            return false;
+        }
+
+        @Override
+        public void setClientInfo(String name, String value) throws SQLClientInfoException {
+        }
+
+        @Override
+        public void setClientInfo(Properties properties) throws SQLClientInfoException {
+        }
+
+        @Override
+        public String getClientInfo(String name) throws SQLException {
+            return null;
+        }
+
+        @Override
+        public Properties getClientInfo() throws SQLException {
+            return null;
+        }
+
+        @Override
+        public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
+            return null;
+        }
+
+        @Override
+        public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
+            return null;
+        }
+
+        @Override
+        public void setSchema(String schema) throws SQLException {
+        }
+
+        @Override
+        public String getSchema() throws SQLException {
+            return null;
+        }
+
+        @Override
+        public void abort(Executor executor) throws SQLException {
+        }
+
+        @Override
+        public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
+        }
+
+        @Override
+        public int getNetworkTimeout() throws SQLException {
+            return 0;
+        }
+    }
+
+    private static class TestXid implements Xid {
+
+        @Override
+        public byte[] getBranchQualifier() {
+            return null;
+        }
+
+        @Override
+        public int getFormatId() {
+            return 0;
+        }
+
+        @Override
+        public byte[] getGlobalTransactionId() {
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/managed/TestManagedDataSource.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestManagedDataSource.java b/src/test/java/org/apache/commons/dbcp2/managed/TestManagedDataSource.java
index 320469f..5f31d7a 100644
--- a/src/test/java/org/apache/commons/dbcp2/managed/TestManagedDataSource.java
+++ b/src/test/java/org/apache/commons/dbcp2/managed/TestManagedDataSource.java
@@ -256,4 +256,31 @@ public class TestManagedDataSource extends TestConnectionPool {
         c1.close();
         c2.close();
     }
+
+    @Test(expected=IllegalStateException.class)
+    public void testTransactionRegistryNotInitialized() throws Exception {
+        try (ManagedDataSource<?> ds = new ManagedDataSource<>(pool, null)) {
+            ds.getConnection();
+        }
+    }
+
+    @Test(expected=IllegalStateException.class)
+    public void testSetTransactionRegistryAlreadySet() {
+        ManagedDataSource<?> managed = (ManagedDataSource<?>) ds;
+        managed.setTransactionRegistry(null);
+    }
+
+    @Test(expected=NullPointerException.class)
+    public void testSetNullTransactionRegistry() throws Exception {
+        try (ManagedDataSource<?> ds = new ManagedDataSource<>(pool, null)) {
+            ds.setTransactionRegistry(null);
+        }
+    }
+
+    @Test()
+    public void testSetTransactionRegistry() throws Exception {
+        try (ManagedDataSource<?> ds = new ManagedDataSource<>(pool, null)) {
+            ds.setTransactionRegistry(new TransactionRegistry(transactionManager));
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/managed/TestPoolableManagedConnection.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestPoolableManagedConnection.java b/src/test/java/org/apache/commons/dbcp2/managed/TestPoolableManagedConnection.java
new file mode 100644
index 0000000..44da212
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbcp2/managed/TestPoolableManagedConnection.java
@@ -0,0 +1,141 @@
+/*
+ *
+ * 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.commons.dbcp2.managed;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Properties;
+
+import javax.transaction.TransactionManager;
+
+import org.apache.commons.dbcp2.ConnectionFactory;
+import org.apache.commons.dbcp2.DriverConnectionFactory;
+import org.apache.commons.dbcp2.PoolableConnection;
+import org.apache.commons.dbcp2.PoolableConnectionFactory;
+import org.apache.commons.dbcp2.TesterDriver;
+import org.apache.commons.pool2.impl.GenericObjectPool;
+import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests for PoolableManagedConnection.
+ */
+public class TestPoolableManagedConnection {
+
+    private TransactionManager transactionManager;
+    private TransactionRegistry transactionRegistry;
+    private GenericObjectPool<PoolableConnection> pool;
+    private Connection conn;
+    private PoolableManagedConnection poolableManagedConnection;
+
+    @Before
+    public void setUp() throws Exception {
+        // create a GeronimoTransactionManager for testing
+        transactionManager = new TransactionManagerImpl();
+
+        // create a driver connection factory
+        final Properties properties = new Properties();
+        properties.setProperty("user", "userName");
+        properties.setProperty("password", "password");
+        final ConnectionFactory connectionFactory = new DriverConnectionFactory(new TesterDriver(), "jdbc:apache:commons:testdriver", properties);
+
+        // wrap it with a LocalXAConnectionFactory
+        final XAConnectionFactory xaConnectionFactory = new LocalXAConnectionFactory(transactionManager, connectionFactory);
+
+        // create transaction registry
+        transactionRegistry = xaConnectionFactory.getTransactionRegistry();
+
+        // create the pool object factory
+        final PoolableConnectionFactory factory = new PoolableConnectionFactory(xaConnectionFactory, null);
+        factory.setValidationQuery("SELECT DUMMY FROM DUAL");
+        factory.setDefaultReadOnly(Boolean.TRUE);
+        factory.setDefaultAutoCommit(Boolean.TRUE);
+
+        // create the pool
+        pool = new GenericObjectPool<>(factory);
+        factory.setPool(pool);
+        pool.setMaxTotal(10);
+        pool.setMaxWaitMillis(100);
+    }
+
+    @After
+    public void tearDown() throws SQLException {
+        if (conn != null && !conn.isClosed())
+            conn.close();
+        if (pool != null && !pool.isClosed())
+            pool.close();
+    }
+
+    @Test
+    public void testManagedConnection() throws Exception {
+        assertEquals(0, pool.getNumActive());
+        // create a connection
+        conn = pool.borrowObject();
+        assertEquals(1, pool.getNumActive());
+        // create the poolable managed connection
+        poolableManagedConnection = new PoolableManagedConnection(transactionRegistry, conn, pool);
+        poolableManagedConnection.close();
+        // closing a poolable managed connection won't close it, but simply return to the pool
+        assertEquals(1, pool.getNumActive());
+        // but closing the underlying connection really closes it
+        conn.close();
+        assertEquals(0, pool.getNumActive());
+    }
+
+    @Test
+    public void testPoolableConnection() throws Exception {
+        // create a connection
+        // pool uses LocalXAConnectionFactory, which register the connection with the TransactionRegistry
+        conn = pool.borrowObject();
+        assertNotNull(transactionRegistry.getXAResource(conn));
+        // create the poolable managed connection
+        poolableManagedConnection = new PoolableManagedConnection(transactionRegistry, conn, pool);
+        poolableManagedConnection.close();
+        assertNotNull(transactionRegistry.getXAResource(conn));
+    }
+
+    @Test
+    public void testReallyClose() throws Exception {
+        assertEquals(0, pool.getNumActive());
+        // create a connection
+        // pool uses LocalXAConnectionFactory, which register the connection with the TransactionRegistry
+        conn = pool.borrowObject();
+        assertEquals(1, pool.getNumActive());
+        assertNotNull(transactionRegistry.getXAResource(conn));
+        // create the poolable managed connection
+        poolableManagedConnection = new PoolableManagedConnection(transactionRegistry, conn, pool);
+        poolableManagedConnection.close();
+        assertNotNull(transactionRegistry.getXAResource(conn));
+        assertEquals(1, pool.getNumActive());
+        // this must close the managed connection, removing it from the transaction registry
+        poolableManagedConnection.reallyClose();
+        try {
+            assertNull(transactionRegistry.getXAResource(conn));
+            fail("Transaction registry was supposed to be empty now");
+        } catch (SQLException e) {}
+        assertEquals(0, pool.getNumActive());
+    }
+}
\ No newline at end of file


[5/5] commons-dbcp git commit: [DBCP-504] Increase test coverage. Closes #13.

Posted by gg...@apache.org.
[DBCP-504] Increase test coverage. Closes #13.

Project: http://git-wip-us.apache.org/repos/asf/commons-dbcp/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-dbcp/commit/64a13ee3
Tree: http://git-wip-us.apache.org/repos/asf/commons-dbcp/tree/64a13ee3
Diff: http://git-wip-us.apache.org/repos/asf/commons-dbcp/diff/64a13ee3

Branch: refs/heads/master
Commit: 64a13ee391894a1aa8b9c0d40d91783d5804377d
Parents: 6290403
Author: Bruno P. Kinoshita <ki...@apache.org>
Authored: Tue Jul 3 19:56:06 2018 -0400
Committer: Gary Gregory <ga...@gmail.com>
Committed: Tue Jul 3 19:56:06 2018 -0400

----------------------------------------------------------------------
 pom.xml                                         |    7 +
 .../dbcp2/TestBasicDataSourceMXBean.java        |  239 +++
 .../org/apache/commons/dbcp2/TestConstants.java |   39 +
 .../dbcp2/TestDataSourceConnectionFactory.java  |  120 ++
 .../dbcp2/TestDelegatingCallableStatement.java  | 1130 ++++++++++-
 .../dbcp2/TestDelegatingDatabaseMetaData.java   | 1449 +++++++++++++-
 .../dbcp2/TestDelegatingPreparedStatement.java  |  505 ++++-
 .../commons/dbcp2/TestDelegatingResultSet.java  | 1835 ++++++++++++++++++
 .../commons/dbcp2/TestDelegatingStatement.java  |  497 ++++-
 .../dbcp2/TestDriverConnectionFactory.java      |   48 +
 .../TestDriverManagerConnectionFactory.java     |   25 +
 .../dbcp2/TestLifetimeExceededException.java    |   41 +
 .../apache/commons/dbcp2/TestListException.java |   50 +
 .../org/apache/commons/dbcp2/TestPStmtKey.java  |   65 +
 .../cpdsadapter/TestDriverAdapterCPDS.java      |   80 +
 .../datasources/TestInstanceKeyDataSource.java  |  257 ++-
 .../datasources/TestPerUserPoolDataSource.java  | 1145 ++++++++++-
 .../commons/dbcp2/datasources/TestPoolKey.java  |   65 +
 .../dbcp2/datasources/TestUserPassKey.java      |   74 +
 .../managed/TestBasicManagedDataSource.java     |  103 +
 .../dbcp2/managed/TestLocalXaResource.java      |  590 ++++++
 .../dbcp2/managed/TestManagedDataSource.java    |   27 +
 .../managed/TestPoolableManagedConnection.java  |  141 ++
 23 files changed, 8443 insertions(+), 89 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 96d4cb4..d4afca5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -187,6 +187,13 @@
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <version>2.19.0</version>
+      <scope>test</scope>
+    </dependency>
+
     <!-- For managed connections -->
     <dependency>
       <groupId>org.apache.geronimo.specs</groupId>

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/TestBasicDataSourceMXBean.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSourceMXBean.java b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSourceMXBean.java
new file mode 100644
index 0000000..1106073
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSourceMXBean.java
@@ -0,0 +1,239 @@
+/*
+ * 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.commons.dbcp2;
+
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+
+/**
+ * Tests for BasicDataSourceMXBean.
+ */
+public class TestBasicDataSourceMXBean {
+
+    /**
+     * Tests the interface defined default method.
+     */
+    @Test
+    public void testDefaultSchema() {
+        assertNull(bean.getDefaultSchema());
+    }
+
+    private BasicDataSourceMXBean bean = new BasicDataSourceMXBean() {
+        
+        @Override
+        public boolean isPoolPreparedStatements() {
+            return false;
+        }
+        
+        @Override
+        public boolean isClosed() {
+            return false;
+        }
+        
+        @Override
+        public boolean isAccessToUnderlyingConnectionAllowed() {
+            return false;
+        }
+        
+        @Override
+        public int getValidationQueryTimeout() {
+            return 0;
+        }
+        
+        @Override
+        public String getValidationQuery() {
+            return null;
+        }
+        
+        @Override
+        public String getUsername() {
+            return null;
+        }
+        
+        @Override
+        public String getUrl() {
+            return null;
+        }
+        
+        @Override
+        public long getTimeBetweenEvictionRunsMillis() {
+            return 0;
+        }
+        
+        @Override
+        public boolean getTestWhileIdle() {
+            return false;
+        }
+        
+        @Override
+        public boolean getTestOnCreate() {
+            return false;
+        }
+        
+        @Override
+        public boolean getTestOnBorrow() {
+            return false;
+        }
+        
+        @Override
+        public long getSoftMinEvictableIdleTimeMillis() {
+            return 0;
+        }
+        
+        @Override
+        public int getRemoveAbandonedTimeout() {
+            return 0;
+        }
+        
+        @Override
+        public boolean getRemoveAbandonedOnMaintenance() {
+            return false;
+        }
+        
+        @Override
+        public boolean getRemoveAbandonedOnBorrow() {
+            return false;
+        }
+        
+        @Override
+        public String getPassword() {
+            return null;
+        }
+        
+        @Override
+        public int getNumTestsPerEvictionRun() {
+            return 0;
+        }
+        
+        @Override
+        public int getNumIdle() {
+            return 0;
+        }
+        
+        @Override
+        public int getNumActive() {
+            return 0;
+        }
+        
+        @Override
+        public int getMinIdle() {
+            return 0;
+        }
+        
+        @Override
+        public long getMinEvictableIdleTimeMillis() {
+            return 0;
+        }
+        
+        @Override
+        public long getMaxWaitMillis() {
+            return 0;
+        }
+        
+        @Override
+        public int getMaxTotal() {
+            return 0;
+        }
+        
+        @Override
+        public int getMaxOpenPreparedStatements() {
+            return 0;
+        }
+        
+        @Override
+        public int getMaxIdle() {
+            return 0;
+        }
+        
+        @Override
+        public long getMaxConnLifetimeMillis() {
+            return 0;
+        }
+        
+        @Override
+        public boolean getLogExpiredConnections() {
+            return false;
+        }
+        
+        @Override
+        public boolean getLogAbandoned() {
+            return false;
+        }
+        
+        @Override
+        public boolean getLifo() {
+            return false;
+        }
+        
+        @Override
+        public int getInitialSize() {
+            return 0;
+        }
+        
+        @Override
+        public boolean getFastFailValidation() {
+            return false;
+        }
+        
+        @Override
+        public String getDriverClassName() {
+            return null;
+        }
+        
+        @Override
+        public String[] getDisconnectionSqlCodesAsArray() {
+            return null;
+        }
+        
+        @Override
+        public int getDefaultTransactionIsolation() {
+            return 0;
+        }
+        
+        @Override
+        public Boolean getDefaultReadOnly() {
+            return null;
+        }
+        
+        @Override
+        public String getDefaultCatalog() {
+            return null;
+        }
+        
+        @Override
+        public Boolean getDefaultAutoCommit() {
+            return null;
+        }
+        
+        @Override
+        public String[] getConnectionInitSqlsAsArray() {
+            return null;
+        }
+        
+        @Override
+        public boolean getCacheState() {
+            return false;
+        }
+        
+        @Override
+        public boolean getAbandonedUsageTracking() {
+            return false;
+        }
+    };
+}

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/TestConstants.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/TestConstants.java b/src/test/java/org/apache/commons/dbcp2/TestConstants.java
new file mode 100644
index 0000000..e66ed3a
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbcp2/TestConstants.java
@@ -0,0 +1,39 @@
+/*
+ * 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.commons.dbcp2;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+/**
+ * Tests for Constants.
+ */
+public class TestConstants {
+
+    @Test
+    public void testConstants() {
+        assertNotNull(new Constants());
+        assertEquals(",connectionpool=", Constants.JMX_CONNECTION_POOL_BASE_EXT);
+        assertEquals("connections", Constants.JMX_CONNECTION_POOL_PREFIX);
+        assertEquals(",connectionpool=connections,connection=", Constants.JMX_CONNECTION_BASE_EXT);
+        assertEquals(",connectionpool=connections,connection=", Constants.JMX_STATEMENT_POOL_BASE_EXT);
+        assertEquals(",statementpool=statements", Constants.JMX_STATEMENT_POOL_PREFIX);
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/TestDataSourceConnectionFactory.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/TestDataSourceConnectionFactory.java b/src/test/java/org/apache/commons/dbcp2/TestDataSourceConnectionFactory.java
new file mode 100644
index 0000000..40d46ec
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbcp2/TestDataSourceConnectionFactory.java
@@ -0,0 +1,120 @@
+/*
+ * 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.commons.dbcp2;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.logging.Logger;
+
+import javax.sql.DataSource;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test for DataSourceConnectionFactory.
+ */
+public class TestDataSourceConnectionFactory {
+
+    private DataSource datasource;
+    private DataSourceConnectionFactory factory;
+
+    @Before
+    public void setUp() {
+        datasource = new TestDataSource();
+        factory = new DataSourceConnectionFactory(datasource);
+    }
+
+    @Test
+    public void testDefaultValues() throws SQLException {
+        Connection conn = factory.createConnection();
+        assertNull(((TesterConnection) conn).getUserName());
+    }
+
+    @Test
+    public void testCredentials() throws SQLException {
+        DataSourceConnectionFactory factory = new DataSourceConnectionFactory(datasource, "foo", "bar");
+        Connection conn = factory.createConnection();
+        assertEquals("foo", ((TesterConnection) conn).getUserName());
+    }
+
+    @Test
+    public void testEmptyPassword() throws SQLException {
+        DataSourceConnectionFactory factory = new DataSourceConnectionFactory(datasource, "foo", (char[]) null);
+        Connection conn = factory.createConnection();
+        assertEquals("foo", ((TesterConnection) conn).getUserName());
+    }
+
+    @Test
+    public void testEmptyUser() throws SQLException {
+        DataSourceConnectionFactory factory = new DataSourceConnectionFactory(datasource, null, new char[] {'a'});
+        Connection conn = factory.createConnection();
+        assertNull(((TesterConnection) conn).getUserName());
+    }
+
+    private static class TestDataSource implements DataSource {
+
+        @Override
+        public PrintWriter getLogWriter() throws SQLException {
+            return null;
+        }
+
+        @Override
+        public void setLogWriter(PrintWriter out) throws SQLException {
+        }
+
+        @Override
+        public void setLoginTimeout(int seconds) throws SQLException {
+        }
+
+        @Override
+        public int getLoginTimeout() throws SQLException {
+            return 0;
+        }
+
+        @Override
+        public Logger getParentLogger() throws SQLFeatureNotSupportedException {
+            return null;
+        }
+
+        @Override
+        public <T> T unwrap(Class<T> iface) throws SQLException {
+            return null;
+        }
+
+        @Override
+        public boolean isWrapperFor(Class<?> iface) throws SQLException {
+            return false;
+        }
+
+        @Override
+        public Connection getConnection() throws SQLException {
+            return new TesterConnection(null, null);
+        }
+
+        @Override
+        public Connection getConnection(String username, String password) throws SQLException {
+            return new TesterConnection(username, password);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/TestDelegatingCallableStatement.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/TestDelegatingCallableStatement.java b/src/test/java/org/apache/commons/dbcp2/TestDelegatingCallableStatement.java
index e45e396..1f16866 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestDelegatingCallableStatement.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestDelegatingCallableStatement.java
@@ -20,46 +20,1140 @@ package org.apache.commons.dbcp2;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
 
 import java.sql.CallableStatement;
 import java.sql.Connection;
+import java.sql.SQLException;
 
 import org.junit.Before;
 import org.junit.Test;
 
-/**
- */
+@SuppressWarnings({ "deprecation", "unchecked", "rawtypes" }) // BigDecimal methods, and casting for mocks
 public class TestDelegatingCallableStatement {
 
-    private DelegatingConnection<Connection> conn = null;
-    private Connection delegateConn = null;
-    private DelegatingCallableStatement stmt = null;
-    private CallableStatement delegateStmt = null;
+    private TesterConnection conn = null;
+    private DelegatingCallableStatement delegate = null;
+    private CallableStatement obj = null;
 
     @Before
     public void setUp() throws Exception {
-        delegateConn = new TesterConnection("test", "test");
-        conn = new DelegatingConnection<>(delegateConn);
+        conn = new TesterConnection("test", "test");
+        obj = mock(CallableStatement.class);
+        DelegatingConnection<Connection> delegatingConnection = new DelegatingConnection<Connection>(conn);
+        delegate = new DelegatingCallableStatement(delegatingConnection, obj);
     }
 
     @Test
     public void testExecuteQueryReturnsNull() throws Exception {
-        delegateStmt = new TesterCallableStatement(delegateConn,"null");
-        stmt = new DelegatingCallableStatement(conn,delegateStmt);
-        assertNull(stmt.executeQuery());
+        TesterCallableStatement delegateStmt = new TesterCallableStatement(conn,"null");
+        obj = new DelegatingCallableStatement(new DelegatingConnection<Connection>(conn),delegateStmt);
+        assertNull(obj.executeQuery());
     }
 
     @Test
     public void testExecuteQueryReturnsNotNull() throws Exception {
-        delegateStmt = new TesterCallableStatement(delegateConn,"select * from foo");
-        stmt = new DelegatingCallableStatement(conn,delegateStmt);
-        assertTrue(null != stmt.executeQuery());
+        TesterCallableStatement delegateStmt = new TesterCallableStatement(conn,"select * from foo");
+        obj = new DelegatingCallableStatement(new DelegatingConnection<Connection>(conn),delegateStmt);
+        assertTrue(null != obj.executeQuery());
     }
 
     @Test
     public void testGetDelegate() throws Exception {
-        delegateStmt = new TesterCallableStatement(delegateConn,"select * from foo");
-        stmt = new DelegatingCallableStatement(conn,delegateStmt);
-        assertEquals(delegateStmt,stmt.getDelegate());
+        TesterCallableStatement delegateStmt = new TesterCallableStatement(conn,"select * from foo");
+        obj = new DelegatingCallableStatement(new DelegatingConnection<Connection>(conn),delegateStmt);
+        assertEquals(delegateStmt,((DelegatingCallableStatement)obj).getDelegate());
+    }
+
+    @Test
+    public void testGetArrayString() throws Exception {
+        try {
+            delegate.getArray("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getArray("foo");
+    }
+
+    @Test
+    public void testGetArrayInteger() throws Exception {
+        try {
+            delegate.getArray(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getArray(1);
+    }
+
+    @Test
+    public void testGetBigDecimalIntegerInteger() throws Exception {
+        try {
+            delegate.getBigDecimal(1, 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getBigDecimal(1, 1);
+    }
+
+    @Test
+    public void testGetBigDecimalInteger() throws Exception {
+        try {
+            delegate.getBigDecimal(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getBigDecimal(1);
+    }
+
+    @Test
+    public void testGetBigDecimalString() throws Exception {
+        try {
+            delegate.getBigDecimal("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getBigDecimal("foo");
+    }
+
+    @Test
+    public void testGetBlobInteger() throws Exception {
+        try {
+            delegate.getBlob(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getBlob(1);
+    }
+
+    @Test
+    public void testGetBlobString() throws Exception {
+        try {
+            delegate.getBlob("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getBlob("foo");
+    }
+
+    @Test
+    public void testGetBooleanInteger() throws Exception {
+        try {
+            delegate.getBoolean(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getBoolean(1);
+    }
+
+    @Test
+    public void testGetBooleanString() throws Exception {
+        try {
+            delegate.getBoolean("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getBoolean("foo");
+    }
+
+    @Test
+    public void testGetByteInteger() throws Exception {
+        try {
+            delegate.getByte(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getByte(1);
+    }
+
+    @Test
+    public void testGetByteString() throws Exception {
+        try {
+            delegate.getByte("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getByte("foo");
+    }
+
+    @Test
+    public void testGetBytesInteger() throws Exception {
+        try {
+            delegate.getBytes(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getBytes(1);
+    }
+
+    @Test
+    public void testGetBytesString() throws Exception {
+        try {
+            delegate.getBytes("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getBytes("foo");
+    }
+
+    @Test
+    public void testGetCharacterStreamInteger() throws Exception {
+        try {
+            delegate.getCharacterStream(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getCharacterStream(1);
+    }
+
+    @Test
+    public void testGetCharacterStreamString() throws Exception {
+        try {
+            delegate.getCharacterStream("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getCharacterStream("foo");
     }
-}
+
+    @Test
+    public void testGetClobInteger() throws Exception {
+        try {
+            delegate.getClob(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getClob(1);
+    }
+
+    @Test
+    public void testGetClobString() throws Exception {
+        try {
+            delegate.getClob("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getClob("foo");
+    }
+
+    @Test
+    public void testGetDateIntegerCalendar() throws Exception {
+        try {
+            delegate.getDate(1, (java.util.Calendar) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getDate(1, (java.util.Calendar) null);
+    }
+
+    @Test
+    public void testGetDateInteger() throws Exception {
+        try {
+            delegate.getDate(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getDate(1);
+    }
+
+    @Test
+    public void testGetDateString() throws Exception {
+        try {
+            delegate.getDate("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getDate("foo");
+    }
+
+    @Test
+    public void testGetDateStringCalendar() throws Exception {
+        try {
+            delegate.getDate("foo", (java.util.Calendar) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getDate("foo", (java.util.Calendar) null);
+    }
+
+    @Test
+    public void testGetDoubleInteger() throws Exception {
+        try {
+            delegate.getDouble(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getDouble(1);
+    }
+
+    @Test
+    public void testGetDoubleString() throws Exception {
+        try {
+            delegate.getDouble("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getDouble("foo");
+    }
+
+    @Test
+    public void testGetFloatString() throws Exception {
+        try {
+            delegate.getFloat("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getFloat("foo");
+    }
+
+    @Test
+    public void testGetFloatInteger() throws Exception {
+        try {
+            delegate.getFloat(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getFloat(1);
+    }
+
+    @Test
+    public void testGetIntString() throws Exception {
+        try {
+            delegate.getInt("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getInt("foo");
+    }
+
+    @Test
+    public void testGetIntInteger() throws Exception {
+        try {
+            delegate.getInt(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getInt(1);
+    }
+
+    @Test
+    public void testGetLongString() throws Exception {
+        try {
+            delegate.getLong("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getLong("foo");
+    }
+
+    @Test
+    public void testGetLongInteger() throws Exception {
+        try {
+            delegate.getLong(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getLong(1);
+    }
+
+    @Test
+    public void testGetNCharacterStreamInteger() throws Exception {
+        try {
+            delegate.getNCharacterStream(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getNCharacterStream(1);
+    }
+
+    @Test
+    public void testGetNCharacterStreamString() throws Exception {
+        try {
+            delegate.getNCharacterStream("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getNCharacterStream("foo");
+    }
+
+    @Test
+    public void testGetNClobString() throws Exception {
+        try {
+            delegate.getNClob("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getNClob("foo");
+    }
+
+    @Test
+    public void testGetNClobInteger() throws Exception {
+        try {
+            delegate.getNClob(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getNClob(1);
+    }
+
+    @Test
+    public void testGetNStringString() throws Exception {
+        try {
+            delegate.getNString("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getNString("foo");
+    }
+
+    @Test
+    public void testGetNStringInteger() throws Exception {
+        try {
+            delegate.getNString(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getNString(1);
+    }
+
+    @Test
+    public void testGetObjectIntegerClass() throws Exception {
+        try {
+            delegate.getObject(1, Object.class);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getObject(1, Object.class);
+    }
+
+    @Test
+    public void testGetObjectStringClass() throws Exception {
+        try {
+            delegate.getObject("foo", Object.class);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getObject("foo", Object.class);
+    }
+
+    @Test
+    public void testGetObjectIntegerMap() throws Exception {
+        try {
+            delegate.getObject(1, (java.util.Map) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getObject(1, (java.util.Map) null);
+    }
+
+    @Test
+    public void testGetObjectString() throws Exception {
+        try {
+            delegate.getObject("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getObject("foo");
+    }
+
+    @Test
+    public void testGetObjectInteger() throws Exception {
+        try {
+            delegate.getObject(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getObject(1);
+    }
+
+    @Test
+    public void testGetObjectStringMap() throws Exception {
+        try {
+            delegate.getObject("foo", (java.util.Map) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getObject("foo", (java.util.Map) null);
+    }
+
+    @Test
+    public void testGetRefInteger() throws Exception {
+        try {
+            delegate.getRef(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getRef(1);
+    }
+
+    @Test
+    public void testGetRefString() throws Exception {
+        try {
+            delegate.getRef("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getRef("foo");
+    }
+
+    @Test
+    public void testGetRowIdInteger() throws Exception {
+        try {
+            delegate.getRowId(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getRowId(1);
+    }
+
+    @Test
+    public void testGetRowIdString() throws Exception {
+        try {
+            delegate.getRowId("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getRowId("foo");
+    }
+
+    @Test
+    public void testGetSQLXMLString() throws Exception {
+        try {
+            delegate.getSQLXML("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getSQLXML("foo");
+    }
+
+    @Test
+    public void testGetSQLXMLInteger() throws Exception {
+        try {
+            delegate.getSQLXML(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getSQLXML(1);
+    }
+
+    @Test
+    public void testGetShortInteger() throws Exception {
+        try {
+            delegate.getShort(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getShort(1);
+    }
+
+    @Test
+    public void testGetShortString() throws Exception {
+        try {
+            delegate.getShort("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getShort("foo");
+    }
+
+    @Test
+    public void testGetStringInteger() throws Exception {
+        try {
+            delegate.getString(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getString(1);
+    }
+
+    @Test
+    public void testGetStringString() throws Exception {
+        try {
+            delegate.getString("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getString("foo");
+    }
+
+    @Test
+    public void testGetTimeIntegerCalendar() throws Exception {
+        try {
+            delegate.getTime(1, (java.util.Calendar) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getTime(1, (java.util.Calendar) null);
+    }
+
+    @Test
+    public void testGetTimeInteger() throws Exception {
+        try {
+            delegate.getTime(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getTime(1);
+    }
+
+    @Test
+    public void testGetTimeString() throws Exception {
+        try {
+            delegate.getTime("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getTime("foo");
+    }
+
+    @Test
+    public void testGetTimeStringCalendar() throws Exception {
+        try {
+            delegate.getTime("foo", (java.util.Calendar) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getTime("foo", (java.util.Calendar) null);
+    }
+
+    @Test
+    public void testGetTimestampStringCalendar() throws Exception {
+        try {
+            delegate.getTimestamp("foo", (java.util.Calendar) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getTimestamp("foo", (java.util.Calendar) null);
+    }
+
+    @Test
+    public void testGetTimestampString() throws Exception {
+        try {
+            delegate.getTimestamp("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getTimestamp("foo");
+    }
+
+    @Test
+    public void testGetTimestampIntegerCalendar() throws Exception {
+        try {
+            delegate.getTimestamp(1, (java.util.Calendar) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getTimestamp(1, (java.util.Calendar) null);
+    }
+
+    @Test
+    public void testGetTimestampInteger() throws Exception {
+        try {
+            delegate.getTimestamp(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getTimestamp(1);
+    }
+
+    @Test
+    public void testGetURLInteger() throws Exception {
+        try {
+            delegate.getURL(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getURL(1);
+    }
+
+    @Test
+    public void testGetURLString() throws Exception {
+        try {
+            delegate.getURL("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getURL("foo");
+    }
+
+    @Test
+    public void testRegisterOutParameterIntegerSQLType() throws Exception {
+        try {
+            delegate.registerOutParameter(1, (java.sql.SQLType) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).registerOutParameter(1, (java.sql.SQLType) null);
+    }
+
+    @Test
+    public void testRegisterOutParameterStringSQLType() throws Exception {
+        try {
+            delegate.registerOutParameter("foo", (java.sql.SQLType) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).registerOutParameter("foo", (java.sql.SQLType) null);
+    }
+
+    @Test
+    public void testRegisterOutParameterStringIntegerString() throws Exception {
+        try {
+            delegate.registerOutParameter("foo", 1, "foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).registerOutParameter("foo", 1, "foo");
+    }
+
+    @Test
+    public void testRegisterOutParameterStringSQLTypeInteger() throws Exception {
+        try {
+            delegate.registerOutParameter("foo", (java.sql.SQLType) null, 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).registerOutParameter("foo", (java.sql.SQLType) null, 1);
+    }
+
+    @Test
+    public void testRegisterOutParameterIntegerSQLTypeString() throws Exception {
+        try {
+            delegate.registerOutParameter(1, (java.sql.SQLType) null, "foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).registerOutParameter(1, (java.sql.SQLType) null, "foo");
+    }
+
+    @Test
+    public void testRegisterOutParameterStringSQLTypeString() throws Exception {
+        try {
+            delegate.registerOutParameter("foo", (java.sql.SQLType) null, "foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).registerOutParameter("foo", (java.sql.SQLType) null, "foo");
+    }
+
+    @Test
+    public void testRegisterOutParameterIntegerIntegerString() throws Exception {
+        try {
+            delegate.registerOutParameter(1, 1, "foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).registerOutParameter(1, 1, "foo");
+    }
+
+    @Test
+    public void testRegisterOutParameterIntegerIntegerInteger() throws Exception {
+        try {
+            delegate.registerOutParameter(1, 1, 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).registerOutParameter(1, 1, 1);
+    }
+
+    @Test
+    public void testRegisterOutParameterIntegerInteger() throws Exception {
+        try {
+            delegate.registerOutParameter(1, 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).registerOutParameter(1, 1);
+    }
+
+    @Test
+    public void testRegisterOutParameterIntegerSQLTypeInteger() throws Exception {
+        try {
+            delegate.registerOutParameter(1, (java.sql.SQLType) null, 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).registerOutParameter(1, (java.sql.SQLType) null, 1);
+    }
+
+    @Test
+    public void testRegisterOutParameterStringIntegerInteger() throws Exception {
+        try {
+            delegate.registerOutParameter("foo", 1, 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).registerOutParameter("foo", 1, 1);
+    }
+
+    @Test
+    public void testRegisterOutParameterStringInteger() throws Exception {
+        try {
+            delegate.registerOutParameter("foo", 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).registerOutParameter("foo", 1);
+    }
+
+    @Test
+    public void testSetAsciiStreamStringInputStreamInteger() throws Exception {
+        try {
+            delegate.setAsciiStream("foo", (java.io.InputStream) null, 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setAsciiStream("foo", (java.io.InputStream) null, 1);
+    }
+
+    @Test
+    public void testSetAsciiStreamStringInputStream() throws Exception {
+        try {
+            delegate.setAsciiStream("foo", (java.io.InputStream) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setAsciiStream("foo", (java.io.InputStream) null);
+    }
+
+    @Test
+    public void testSetAsciiStreamStringInputStreamLong() throws Exception {
+        try {
+            delegate.setAsciiStream("foo", (java.io.InputStream) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setAsciiStream("foo", (java.io.InputStream) null, 1l);
+    }
+
+    @Test
+    public void testSetBigDecimalStringBigDecimal() throws Exception {
+        try {
+            delegate.setBigDecimal("foo", java.math.BigDecimal.valueOf(1.0d));
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setBigDecimal("foo", java.math.BigDecimal.valueOf(1.0d));
+    }
+
+    @Test
+    public void testSetBinaryStreamStringInputStreamInteger() throws Exception {
+        try {
+            delegate.setBinaryStream("foo", (java.io.InputStream) null, 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setBinaryStream("foo", (java.io.InputStream) null, 1);
+    }
+
+    @Test
+    public void testSetBinaryStreamStringInputStream() throws Exception {
+        try {
+            delegate.setBinaryStream("foo", (java.io.InputStream) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setBinaryStream("foo", (java.io.InputStream) null);
+    }
+
+    @Test
+    public void testSetBinaryStreamStringInputStreamLong() throws Exception {
+        try {
+            delegate.setBinaryStream("foo", (java.io.InputStream) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setBinaryStream("foo", (java.io.InputStream) null, 1l);
+    }
+
+    @Test
+    public void testSetBlobStringInputStreamLong() throws Exception {
+        try {
+            delegate.setBlob("foo", (java.io.InputStream) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setBlob("foo", (java.io.InputStream) null, 1l);
+    }
+
+    @Test
+    public void testSetBlobStringInputStream() throws Exception {
+        try {
+            delegate.setBlob("foo", (java.io.InputStream) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setBlob("foo", (java.io.InputStream) null);
+    }
+
+    @Test
+    public void testSetBlobStringBlob() throws Exception {
+        try {
+            delegate.setBlob("foo", (java.sql.Blob) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setBlob("foo", (java.sql.Blob) null);
+    }
+
+    @Test
+    public void testSetBooleanStringBoolean() throws Exception {
+        try {
+            delegate.setBoolean("foo", Boolean.TRUE);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setBoolean("foo", Boolean.TRUE);
+    }
+
+    @Test
+    public void testSetByteStringByte() throws Exception {
+        try {
+            delegate.setByte("foo", (byte) 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setByte("foo", (byte) 1);
+    }
+
+    @Test
+    public void testSetBytesStringByteArray() throws Exception {
+        try {
+            delegate.setBytes("foo", new byte[] { 1 });
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setBytes("foo", new byte[] { 1 });
+    }
+
+    @Test
+    public void testSetCharacterStreamStringReaderInteger() throws Exception {
+        try {
+            delegate.setCharacterStream("foo", (java.io.StringReader) null, 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setCharacterStream("foo", (java.io.StringReader) null, 1);
+    }
+
+    @Test
+    public void testSetCharacterStreamStringReader() throws Exception {
+        try {
+            delegate.setCharacterStream("foo", (java.io.StringReader) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setCharacterStream("foo", (java.io.StringReader) null);
+    }
+
+    @Test
+    public void testSetCharacterStreamStringReaderLong() throws Exception {
+        try {
+            delegate.setCharacterStream("foo", (java.io.StringReader) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setCharacterStream("foo", (java.io.StringReader) null, 1l);
+    }
+
+    @Test
+    public void testSetClobStringReader() throws Exception {
+        try {
+            delegate.setClob("foo", (java.io.StringReader) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setClob("foo", (java.io.StringReader) null);
+    }
+
+    @Test
+    public void testSetClobStringReaderLong() throws Exception {
+        try {
+            delegate.setClob("foo", (java.io.StringReader) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setClob("foo", (java.io.StringReader) null, 1l);
+    }
+
+    @Test
+    public void testSetClobStringClob() throws Exception {
+        try {
+            delegate.setClob("foo", (java.sql.Clob) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setClob("foo", (java.sql.Clob) null);
+    }
+
+    @Test
+    public void testSetDateStringSqlDateCalendar() throws Exception {
+        try {
+            delegate.setDate("foo", new java.sql.Date(1529827548745l), (java.util.Calendar) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setDate("foo", new java.sql.Date(1529827548745l), (java.util.Calendar) null);
+    }
+
+    @Test
+    public void testSetDateStringSqlDate() throws Exception {
+        try {
+            delegate.setDate("foo", new java.sql.Date(1529827548745l));
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setDate("foo", new java.sql.Date(1529827548745l));
+    }
+
+    @Test
+    public void testSetDoubleStringDouble() throws Exception {
+        try {
+            delegate.setDouble("foo", 1.0d);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setDouble("foo", 1.0d);
+    }
+
+    @Test
+    public void testSetFloatStringFloat() throws Exception {
+        try {
+            delegate.setFloat("foo", 1.0f);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setFloat("foo", 1.0f);
+    }
+
+    @Test
+    public void testSetIntStringInteger() throws Exception {
+        try {
+            delegate.setInt("foo", 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setInt("foo", 1);
+    }
+
+    @Test
+    public void testSetLongStringLong() throws Exception {
+        try {
+            delegate.setLong("foo", 1l);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setLong("foo", 1l);
+    }
+
+    @Test
+    public void testSetNCharacterStreamStringReaderLong() throws Exception {
+        try {
+            delegate.setNCharacterStream("foo", (java.io.StringReader) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setNCharacterStream("foo", (java.io.StringReader) null, 1l);
+    }
+
+    @Test
+    public void testSetNCharacterStreamStringReader() throws Exception {
+        try {
+            delegate.setNCharacterStream("foo", (java.io.StringReader) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setNCharacterStream("foo", (java.io.StringReader) null);
+    }
+
+    @Test
+    public void testSetNClobStringReaderLong() throws Exception {
+        try {
+            delegate.setNClob("foo", (java.io.StringReader) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setNClob("foo", (java.io.StringReader) null, 1l);
+    }
+
+    @Test
+    public void testSetNClobStringReader() throws Exception {
+        try {
+            delegate.setNClob("foo", (java.io.StringReader) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setNClob("foo", (java.io.StringReader) null);
+    }
+
+    @Test
+    public void testSetNClobStringNClob() throws Exception {
+        try {
+            delegate.setNClob("foo", (java.sql.NClob) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setNClob("foo", (java.sql.NClob) null);
+    }
+
+    @Test
+    public void testSetNStringStringString() throws Exception {
+        try {
+            delegate.setNString("foo", "foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setNString("foo", "foo");
+    }
+
+    @Test
+    public void testSetNullStringInteger() throws Exception {
+        try {
+            delegate.setNull("foo", 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setNull("foo", 1);
+    }
+
+    @Test
+    public void testSetNullStringIntegerString() throws Exception {
+        try {
+            delegate.setNull("foo", 1, "foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setNull("foo", 1, "foo");
+    }
+
+    @Test
+    public void testSetObjectStringObjectIntegerInteger() throws Exception {
+        try {
+            delegate.setObject("foo", System.err, 1, 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setObject("foo", System.err, 1, 1);
+    }
+
+    @Test
+    public void testSetObjectStringObjectSQLType() throws Exception {
+        try {
+            delegate.setObject("foo", System.err, (java.sql.SQLType) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setObject("foo", System.err, (java.sql.SQLType) null);
+    }
+
+    @Test
+    public void testSetObjectStringObjectSQLTypeInteger() throws Exception {
+        try {
+            delegate.setObject("foo", System.err, (java.sql.SQLType) null, 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setObject("foo", System.err, (java.sql.SQLType) null, 1);
+    }
+
+    @Test
+    public void testSetObjectStringObjectInteger() throws Exception {
+        try {
+            delegate.setObject("foo", System.err, 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setObject("foo", System.err, 1);
+    }
+
+    @Test
+    public void testSetObjectStringObject() throws Exception {
+        try {
+            delegate.setObject("foo", System.err);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setObject("foo", System.err);
+    }
+
+    @Test
+    public void testSetRowIdStringRowId() throws Exception {
+        try {
+            delegate.setRowId("foo", (java.sql.RowId) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setRowId("foo", (java.sql.RowId) null);
+    }
+
+    @Test
+    public void testSetSQLXMLStringSQLXML() throws Exception {
+        try {
+            delegate.setSQLXML("foo", (java.sql.SQLXML) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setSQLXML("foo", (java.sql.SQLXML) null);
+    }
+
+    @Test
+    public void testSetShortStringShort() throws Exception {
+        try {
+            delegate.setShort("foo", (short) 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setShort("foo", (short) 1);
+    }
+
+    @Test
+    public void testSetStringStringString() throws Exception {
+        try {
+            delegate.setString("foo", "foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setString("foo", "foo");
+    }
+
+    @Test
+    public void testSetTimeStringTimeCalendar() throws Exception {
+        try {
+            delegate.setTime("foo", (java.sql.Time) null, (java.util.Calendar) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setTime("foo", (java.sql.Time) null, (java.util.Calendar) null);
+    }
+
+    @Test
+    public void testSetTimeStringTime() throws Exception {
+        try {
+            delegate.setTime("foo", (java.sql.Time) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setTime("foo", (java.sql.Time) null);
+    }
+
+    @Test
+    public void testSetTimestampStringTimestamp() throws Exception {
+        try {
+            delegate.setTimestamp("foo", (java.sql.Timestamp) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setTimestamp("foo", (java.sql.Timestamp) null);
+    }
+
+    @Test
+    public void testSetTimestampStringTimestampCalendar() throws Exception {
+        try {
+            delegate.setTimestamp("foo", (java.sql.Timestamp) null, (java.util.Calendar) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setTimestamp("foo", (java.sql.Timestamp) null, (java.util.Calendar) null);
+    }
+
+    @Test
+    public void testSetURLStringUrl() throws Exception {
+        try {
+            delegate.setURL("foo", (java.net.URL) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setURL("foo", (java.net.URL) null);
+    }
+
+    @Test
+    public void testWasNull() throws Exception {
+        try {
+            delegate.wasNull();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).wasNull();
+    }
+
+}
\ No newline at end of file


[3/5] commons-dbcp git commit: [DBCP-504] Increase test coverage. Closes #13.

Posted by gg...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/TestDelegatingResultSet.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/TestDelegatingResultSet.java b/src/test/java/org/apache/commons/dbcp2/TestDelegatingResultSet.java
new file mode 100644
index 0000000..f677fde
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbcp2/TestDelegatingResultSet.java
@@ -0,0 +1,1835 @@
+/*
+ * 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.commons.dbcp2;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Tests for DelegatingResultSet.
+ */
+@SuppressWarnings({ "deprecation", "unchecked", "rawtypes" }) // BigDecimal methods, and casting for mocks
+public class TestDelegatingResultSet {
+
+    private TesterConnection testConn;
+    private DelegatingConnection<Connection> conn;
+    private ResultSet rs;
+    private DelegatingResultSet delegate;
+
+    @Before
+    public void setUp() {
+        testConn = new TesterConnection("foo", "bar");
+        conn = new DelegatingConnection<Connection>(testConn);
+        rs = mock(ResultSet.class);
+        delegate = (DelegatingResultSet) DelegatingResultSet.wrapResultSet((Connection) conn, rs);
+    }
+
+    @Test
+    public void testAbsolutes() throws Exception {
+        try {
+            delegate.absolute(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).absolute(1);
+    }
+
+    @Test
+    public void testAbsoluteInteger() throws Exception {
+        try {
+            delegate.absolute(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).absolute(1);
+    }
+
+    @Test
+    public void testAfterLast() throws Exception {
+        try {
+            delegate.afterLast();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).afterLast();
+    }
+
+    @Test
+    public void testBeforeFirst() throws Exception {
+        try {
+            delegate.beforeFirst();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).beforeFirst();
+    }
+
+    @Test
+    public void testCancelRowUpdates() throws Exception {
+        try {
+            delegate.cancelRowUpdates();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).cancelRowUpdates();
+    }
+
+    @Test
+    public void testClearWarnings() throws Exception {
+        try {
+            delegate.clearWarnings();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).clearWarnings();
+    }
+
+    @Test
+    public void testClose() throws Exception {
+        try {
+            delegate.close();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).close();
+    }
+
+    @Test
+    public void testDeleteRow() throws Exception {
+        try {
+            delegate.deleteRow();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).deleteRow();
+    }
+
+    @Test
+    public void testFindColumnString() throws Exception {
+        try {
+            delegate.findColumn("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).findColumn("foo");
+    }
+
+    @Test
+    public void testFirst() throws Exception {
+        try {
+            delegate.first();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).first();
+    }
+
+    @Test
+    public void testGetArrayInteger() throws Exception {
+        try {
+            delegate.getArray(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getArray(1);
+    }
+
+    @Test
+    public void testGetArrayString() throws Exception {
+        try {
+            delegate.getArray("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getArray("foo");
+    }
+
+    @Test
+    public void testGetAsciiStreamInteger() throws Exception {
+        try {
+            delegate.getAsciiStream(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getAsciiStream(1);
+    }
+
+    @Test
+    public void testGetAsciiStreamString() throws Exception {
+        try {
+            delegate.getAsciiStream("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getAsciiStream("foo");
+    }
+
+    // FIXME: this appears to be a bug
+    @Ignore
+    @Test
+    public void testGetBigDecimalStringInteger() throws Exception {
+        try {
+            delegate.getBigDecimal("foo", 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getBigDecimal("foo", 1);
+    }
+
+    // FIXME: this appears to be a bug
+    @Ignore
+    @Test
+    public void testGetBigDecimalIntegerInteger() throws Exception {
+        try {
+            delegate.getBigDecimal(1, 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getBigDecimal(1, 1);
+    }
+
+    @Test
+    public void testGetBigDecimalInteger() throws Exception {
+        try {
+            delegate.getBigDecimal(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getBigDecimal(1);
+    }
+
+    @Test
+    public void testGetBigDecimalString() throws Exception {
+        try {
+            delegate.getBigDecimal("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getBigDecimal("foo");
+    }
+
+    @Test
+    public void testGetBinaryStreamString() throws Exception {
+        try {
+            delegate.getBinaryStream("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getBinaryStream("foo");
+    }
+
+    @Test
+    public void testGetBinaryStreamInteger() throws Exception {
+        try {
+            delegate.getBinaryStream(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getBinaryStream(1);
+    }
+
+    @Test
+    public void testGetBlobString() throws Exception {
+        try {
+            delegate.getBlob("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getBlob("foo");
+    }
+
+    @Test
+    public void testGetBlobInteger() throws Exception {
+        try {
+            delegate.getBlob(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getBlob(1);
+    }
+
+    @Test
+    public void testGetBooleanInteger() throws Exception {
+        try {
+            delegate.getBoolean(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getBoolean(1);
+    }
+
+    @Test
+    public void testGetBooleanString() throws Exception {
+        try {
+            delegate.getBoolean("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getBoolean("foo");
+    }
+
+    @Test
+    public void testGetByteString() throws Exception {
+        try {
+            delegate.getByte("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getByte("foo");
+    }
+
+    @Test
+    public void testGetByteInteger() throws Exception {
+        try {
+            delegate.getByte(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getByte(1);
+    }
+
+    @Test
+    public void testGetBytesInteger() throws Exception {
+        try {
+            delegate.getBytes(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getBytes(1);
+    }
+
+    @Test
+    public void testGetBytesString() throws Exception {
+        try {
+            delegate.getBytes("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getBytes("foo");
+    }
+
+    @Test
+    public void testGetCharacterStreamString() throws Exception {
+        try {
+            delegate.getCharacterStream("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getCharacterStream("foo");
+    }
+
+    @Test
+    public void testGetCharacterStreamInteger() throws Exception {
+        try {
+            delegate.getCharacterStream(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getCharacterStream(1);
+    }
+
+    @Test
+    public void testGetClobInteger() throws Exception {
+        try {
+            delegate.getClob(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getClob(1);
+    }
+
+    @Test
+    public void testGetClobString() throws Exception {
+        try {
+            delegate.getClob("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getClob("foo");
+    }
+
+    @Test
+    public void testGetConcurrency() throws Exception {
+        try {
+            delegate.getConcurrency();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getConcurrency();
+    }
+
+    @Test
+    public void testGetCursorName() throws Exception {
+        try {
+            delegate.getCursorName();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getCursorName();
+    }
+
+    @Test
+    public void testGetDateInteger() throws Exception {
+        try {
+            delegate.getDate(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getDate(1);
+    }
+
+    @Test
+    public void testGetDateString() throws Exception {
+        try {
+            delegate.getDate("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getDate("foo");
+    }
+
+    @Test
+    public void testGetDateStringCalendar() throws Exception {
+        try {
+            delegate.getDate("foo", (java.util.Calendar) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getDate("foo", (java.util.Calendar) null);
+    }
+
+    @Test
+    public void testGetDateIntegerCalendar() throws Exception {
+        try {
+            delegate.getDate(1, (java.util.Calendar) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getDate(1, (java.util.Calendar) null);
+    }
+
+    @Test
+    public void testGetDoubleString() throws Exception {
+        try {
+            delegate.getDouble("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getDouble("foo");
+    }
+
+    @Test
+    public void testGetDoubleInteger() throws Exception {
+        try {
+            delegate.getDouble(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getDouble(1);
+    }
+
+    @Test
+    public void testGetFetchDirection() throws Exception {
+        try {
+            delegate.getFetchDirection();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getFetchDirection();
+    }
+
+    @Test
+    public void testGetFetchSize() throws Exception {
+        try {
+            delegate.getFetchSize();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getFetchSize();
+    }
+
+    @Test
+    public void testGetFloatString() throws Exception {
+        try {
+            delegate.getFloat("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getFloat("foo");
+    }
+
+    @Test
+    public void testGetFloatInteger() throws Exception {
+        try {
+            delegate.getFloat(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getFloat(1);
+    }
+
+    @Test
+    public void testGetHoldability() throws Exception {
+        try {
+            delegate.getHoldability();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getHoldability();
+    }
+
+    @Test
+    public void testGetIntInteger() throws Exception {
+        try {
+            delegate.getInt(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getInt(1);
+    }
+
+    @Test
+    public void testGetIntString() throws Exception {
+        try {
+            delegate.getInt("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getInt("foo");
+    }
+
+    @Test
+    public void testGetLongInteger() throws Exception {
+        try {
+            delegate.getLong(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getLong(1);
+    }
+
+    @Test
+    public void testGetLongString() throws Exception {
+        try {
+            delegate.getLong("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getLong("foo");
+    }
+
+    @Test
+    public void testGetMetaData() throws Exception {
+        try {
+            delegate.getMetaData();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getMetaData();
+    }
+
+    @Test
+    public void testGetNCharacterStreamString() throws Exception {
+        try {
+            delegate.getNCharacterStream("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getNCharacterStream("foo");
+    }
+
+    @Test
+    public void testGetNCharacterStreamInteger() throws Exception {
+        try {
+            delegate.getNCharacterStream(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getNCharacterStream(1);
+    }
+
+    @Test
+    public void testGetNClobString() throws Exception {
+        try {
+            delegate.getNClob("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getNClob("foo");
+    }
+
+    @Test
+    public void testGetNClobInteger() throws Exception {
+        try {
+            delegate.getNClob(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getNClob(1);
+    }
+
+    @Test
+    public void testGetNStringString() throws Exception {
+        try {
+            delegate.getNString("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getNString("foo");
+    }
+
+    @Test
+    public void testGetNStringInteger() throws Exception {
+        try {
+            delegate.getNString(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getNString(1);
+    }
+
+    @Test
+    public void testGetObjectIntegerClass() throws Exception {
+        try {
+            delegate.getObject(1, Object.class);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getObject(1, Object.class);
+    }
+
+    @Test
+    public void testGetObjectIntegerMap() throws Exception {
+        try {
+            delegate.getObject(1, (java.util.Map) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getObject(1, (java.util.Map) null);
+    }
+
+    @Test
+    public void testGetObjectString() throws Exception {
+        try {
+            delegate.getObject("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getObject("foo");
+    }
+
+    @Test
+    public void testGetObjectStringMap() throws Exception {
+        try {
+            delegate.getObject("foo", (java.util.Map) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getObject("foo", (java.util.Map) null);
+    }
+
+    @Test
+    public void testGetObjectInteger() throws Exception {
+        try {
+            delegate.getObject(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getObject(1);
+    }
+
+    @Test
+    public void testGetObjectStringClass() throws Exception {
+        try {
+            delegate.getObject("foo", Object.class);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getObject("foo", Object.class);
+    }
+
+    @Test
+    public void testGetRefInteger() throws Exception {
+        try {
+            delegate.getRef(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getRef(1);
+    }
+
+    @Test
+    public void testGetRefString() throws Exception {
+        try {
+            delegate.getRef("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getRef("foo");
+    }
+
+    @Test
+    public void testGetRow() throws Exception {
+        try {
+            delegate.getRow();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getRow();
+    }
+
+    @Test
+    public void testGetRowIdString() throws Exception {
+        try {
+            delegate.getRowId("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getRowId("foo");
+    }
+
+    @Test
+    public void testGetRowIdInteger() throws Exception {
+        try {
+            delegate.getRowId(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getRowId(1);
+    }
+
+    @Test
+    public void testGetSQLXMLString() throws Exception {
+        try {
+            delegate.getSQLXML("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getSQLXML("foo");
+    }
+
+    @Test
+    public void testGetSQLXMLInteger() throws Exception {
+        try {
+            delegate.getSQLXML(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getSQLXML(1);
+    }
+
+    @Test
+    public void testGetShortInteger() throws Exception {
+        try {
+            delegate.getShort(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getShort(1);
+    }
+
+    @Test
+    public void testGetShortString() throws Exception {
+        try {
+            delegate.getShort("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getShort("foo");
+    }
+
+    /**
+     * This method is a bit special. It actually calls statement in the
+     * {@link DelegatingResultSet} object itself, instead of calling in the
+     * underlying {@link ResultSet}.
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testGetStatement() throws Exception {
+        try {
+            delegate.getStatement();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(0)).getStatement();
+    }
+
+    @Test
+    public void testGetStringInteger() throws Exception {
+        try {
+            delegate.getString(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getString(1);
+    }
+
+    @Test
+    public void testGetStringString() throws Exception {
+        try {
+            delegate.getString("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getString("foo");
+    }
+
+    @Test
+    public void testGetTimeInteger() throws Exception {
+        try {
+            delegate.getTime(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getTime(1);
+    }
+
+    @Test
+    public void testGetTimeIntegerCalendar() throws Exception {
+        try {
+            delegate.getTime(1, (java.util.Calendar) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getTime(1, (java.util.Calendar) null);
+    }
+
+    @Test
+    public void testGetTimeString() throws Exception {
+        try {
+            delegate.getTime("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getTime("foo");
+    }
+
+    @Test
+    public void testGetTimeStringCalendar() throws Exception {
+        try {
+            delegate.getTime("foo", (java.util.Calendar) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getTime("foo", (java.util.Calendar) null);
+    }
+
+    @Test
+    public void testGetTimestampString() throws Exception {
+        try {
+            delegate.getTimestamp("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getTimestamp("foo");
+    }
+
+    @Test
+    public void testGetTimestampIntegerCalendar() throws Exception {
+        try {
+            delegate.getTimestamp(1, (java.util.Calendar) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getTimestamp(1, (java.util.Calendar) null);
+    }
+
+    @Test
+    public void testGetTimestampInteger() throws Exception {
+        try {
+            delegate.getTimestamp(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getTimestamp(1);
+    }
+
+    @Test
+    public void testGetTimestampStringCalendar() throws Exception {
+        try {
+            delegate.getTimestamp("foo", (java.util.Calendar) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getTimestamp("foo", (java.util.Calendar) null);
+    }
+
+    @Test
+    public void testGetType() throws Exception {
+        try {
+            delegate.getType();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getType();
+    }
+
+    @Test
+    public void testGetURLInteger() throws Exception {
+        try {
+            delegate.getURL(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getURL(1);
+    }
+
+    @Test
+    public void testGetURLString() throws Exception {
+        try {
+            delegate.getURL("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getURL("foo");
+    }
+
+    @Test
+    public void testGetUnicodeStreamString() throws Exception {
+        try {
+            delegate.getUnicodeStream("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getUnicodeStream("foo");
+    }
+
+    @Test
+    public void testGetUnicodeStreamInteger() throws Exception {
+        try {
+            delegate.getUnicodeStream(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getUnicodeStream(1);
+    }
+
+    @Test
+    public void testGetWarnings() throws Exception {
+        try {
+            delegate.getWarnings();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).getWarnings();
+    }
+
+    @Test
+    public void testInsertRow() throws Exception {
+        try {
+            delegate.insertRow();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).insertRow();
+    }
+
+    @Test
+    public void testIsAfterLast() throws Exception {
+        try {
+            delegate.isAfterLast();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).isAfterLast();
+    }
+
+    @Test
+    public void testIsBeforeFirst() throws Exception {
+        try {
+            delegate.isBeforeFirst();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).isBeforeFirst();
+    }
+
+    @Test
+    public void testIsClosed() throws Exception {
+        try {
+            delegate.isClosed();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).isClosed();
+    }
+
+    @Test
+    public void testIsFirst() throws Exception {
+        try {
+            delegate.isFirst();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).isFirst();
+    }
+
+    @Test
+    public void testIsLast() throws Exception {
+        try {
+            delegate.isLast();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).isLast();
+    }
+
+    @Test
+    public void testLast() throws Exception {
+        try {
+            delegate.last();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).last();
+    }
+
+    @Test
+    public void testMoveToCurrentRow() throws Exception {
+        try {
+            delegate.moveToCurrentRow();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).moveToCurrentRow();
+    }
+
+    @Test
+    public void testMoveToInsertRow() throws Exception {
+        try {
+            delegate.moveToInsertRow();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).moveToInsertRow();
+    }
+
+    @Test
+    public void testNext() throws Exception {
+        try {
+            delegate.next();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).next();
+    }
+
+    @Test
+    public void testPrevious() throws Exception {
+        try {
+            delegate.previous();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).previous();
+    }
+
+    @Test
+    public void testRefreshRow() throws Exception {
+        try {
+            delegate.refreshRow();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).refreshRow();
+    }
+
+    @Test
+    public void testRelativeInteger() throws Exception {
+        try {
+            delegate.relative(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).relative(1);
+    }
+
+    @Test
+    public void testRowDeleted() throws Exception {
+        try {
+            delegate.rowDeleted();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).rowDeleted();
+    }
+
+    @Test
+    public void testRowInserted() throws Exception {
+        try {
+            delegate.rowInserted();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).rowInserted();
+    }
+
+    @Test
+    public void testRowUpdated() throws Exception {
+        try {
+            delegate.rowUpdated();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).rowUpdated();
+    }
+
+    @Test
+    public void testSetFetchDirectionInteger() throws Exception {
+        try {
+            delegate.setFetchDirection(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).setFetchDirection(1);
+    }
+
+    @Test
+    public void testSetFetchSizeInteger() throws Exception {
+        try {
+            delegate.setFetchSize(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).setFetchSize(1);
+    }
+
+    @Test
+    public void testUpdateArrayStringArray() throws Exception {
+        try {
+            delegate.updateArray("foo", (java.sql.Array) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateArray("foo", (java.sql.Array) null);
+    }
+
+    @Test
+    public void testUpdateArrayIntegerArray() throws Exception {
+        try {
+            delegate.updateArray(1, (java.sql.Array) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateArray(1, (java.sql.Array) null);
+    }
+
+    @Test
+    public void testUpdateAsciiStreamStringInputStreamInteger() throws Exception {
+        try {
+            delegate.updateAsciiStream("foo", (java.io.InputStream) null, 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateAsciiStream("foo", (java.io.InputStream) null, 1);
+    }
+
+    @Test
+    public void testUpdateAsciiStreamStringInputStreamLong() throws Exception {
+        try {
+            delegate.updateAsciiStream("foo", (java.io.InputStream) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateAsciiStream("foo", (java.io.InputStream) null, 1l);
+    }
+
+    @Test
+    public void testUpdateAsciiStreamIntegerInputStreamInteger() throws Exception {
+        try {
+            delegate.updateAsciiStream(1, (java.io.InputStream) null, 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateAsciiStream(1, (java.io.InputStream) null, 1);
+    }
+
+    @Test
+    public void testUpdateAsciiStreamIntegerInputStream() throws Exception {
+        try {
+            delegate.updateAsciiStream(1, (java.io.InputStream) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateAsciiStream(1, (java.io.InputStream) null);
+    }
+
+    @Test
+    public void testUpdateAsciiStreamIntegerInputStreamLong() throws Exception {
+        try {
+            delegate.updateAsciiStream(1, (java.io.InputStream) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateAsciiStream(1, (java.io.InputStream) null, 1l);
+    }
+
+    @Test
+    public void testUpdateAsciiStreamStringInputStream() throws Exception {
+        try {
+            delegate.updateAsciiStream("foo", (java.io.InputStream) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateAsciiStream("foo", (java.io.InputStream) null);
+    }
+
+    @Test
+    public void testUpdateBigDecimalStringBigDecimal() throws Exception {
+        try {
+            delegate.updateBigDecimal("foo", java.math.BigDecimal.valueOf(1.0d));
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBigDecimal("foo", java.math.BigDecimal.valueOf(1.0d));
+    }
+
+    @Test
+    public void testUpdateBigDecimalIntegerBigDecimal() throws Exception {
+        try {
+            delegate.updateBigDecimal(1, java.math.BigDecimal.valueOf(1.0d));
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBigDecimal(1, java.math.BigDecimal.valueOf(1.0d));
+    }
+
+    @Test
+    public void testUpdateBinaryStreamIntegerInputStream() throws Exception {
+        try {
+            delegate.updateBinaryStream(1, (java.io.InputStream) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBinaryStream(1, (java.io.InputStream) null);
+    }
+
+    @Test
+    public void testUpdateBinaryStreamIntegerInputStreamInteger() throws Exception {
+        try {
+            delegate.updateBinaryStream(1, (java.io.InputStream) null, 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBinaryStream(1, (java.io.InputStream) null, 1);
+    }
+
+    @Test
+    public void testUpdateBinaryStreamIntegerInputStreamLong() throws Exception {
+        try {
+            delegate.updateBinaryStream(1, (java.io.InputStream) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBinaryStream(1, (java.io.InputStream) null, 1l);
+    }
+
+    @Test
+    public void testUpdateBinaryStreamStringInputStreamLong() throws Exception {
+        try {
+            delegate.updateBinaryStream("foo", (java.io.InputStream) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBinaryStream("foo", (java.io.InputStream) null, 1l);
+    }
+
+    @Test
+    public void testUpdateBinaryStreamStringInputStreamInteger() throws Exception {
+        try {
+            delegate.updateBinaryStream("foo", (java.io.InputStream) null, 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBinaryStream("foo", (java.io.InputStream) null, 1);
+    }
+
+    @Test
+    public void testUpdateBinaryStreamStringInputStream() throws Exception {
+        try {
+            delegate.updateBinaryStream("foo", (java.io.InputStream) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBinaryStream("foo", (java.io.InputStream) null);
+    }
+
+    @Test
+    public void testUpdateBlobIntegerBlob() throws Exception {
+        try {
+            delegate.updateBlob(1, (java.sql.Blob) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBlob(1, (java.sql.Blob) null);
+    }
+
+    @Test
+    public void testUpdateBlobStringInputStream() throws Exception {
+        try {
+            delegate.updateBlob("foo", (java.io.InputStream) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBlob("foo", (java.io.InputStream) null);
+    }
+
+    @Test
+    public void testUpdateBlobStringBlob() throws Exception {
+        try {
+            delegate.updateBlob("foo", (java.sql.Blob) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBlob("foo", (java.sql.Blob) null);
+    }
+
+    @Test
+    public void testUpdateBlobStringInputStreamLong() throws Exception {
+        try {
+            delegate.updateBlob("foo", (java.io.InputStream) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBlob("foo", (java.io.InputStream) null, 1l);
+    }
+
+    @Test
+    public void testUpdateBlobIntegerInputStream() throws Exception {
+        try {
+            delegate.updateBlob(1, (java.io.InputStream) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBlob(1, (java.io.InputStream) null);
+    }
+
+    @Test
+    public void testUpdateBlobIntegerInputStreamLong() throws Exception {
+        try {
+            delegate.updateBlob(1, (java.io.InputStream) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBlob(1, (java.io.InputStream) null, 1l);
+    }
+
+    @Test
+    public void testUpdateBooleanIntegerBoolean() throws Exception {
+        try {
+            delegate.updateBoolean(1, Boolean.TRUE);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBoolean(1, Boolean.TRUE);
+    }
+
+    @Test
+    public void testUpdateBooleanStringBoolean() throws Exception {
+        try {
+            delegate.updateBoolean("foo", Boolean.TRUE);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBoolean("foo", Boolean.TRUE);
+    }
+
+    @Test
+    public void testUpdateByteStringByte() throws Exception {
+        try {
+            delegate.updateByte("foo", (byte) 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateByte("foo", (byte) 1);
+    }
+
+    @Test
+    public void testUpdateByteIntegerByte() throws Exception {
+        try {
+            delegate.updateByte(1, (byte) 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateByte(1, (byte) 1);
+    }
+
+    @Test
+    public void testUpdateBytesIntegerByteArray() throws Exception {
+        try {
+            delegate.updateBytes(1, new byte[] { 1 });
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBytes(1, new byte[] { 1 });
+    }
+
+    @Test
+    public void testUpdateBytesStringByteArray() throws Exception {
+        try {
+            delegate.updateBytes("foo", new byte[] { 1 });
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateBytes("foo", new byte[] { 1 });
+    }
+
+    @Test
+    public void testUpdateCharacterStreamIntegerReaderInteger() throws Exception {
+        try {
+            delegate.updateCharacterStream(1, (java.io.StringReader) null, 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateCharacterStream(1, (java.io.StringReader) null, 1);
+    }
+
+    @Test
+    public void testUpdateCharacterStreamIntegerReaderLong() throws Exception {
+        try {
+            delegate.updateCharacterStream(1, (java.io.StringReader) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateCharacterStream(1, (java.io.StringReader) null, 1l);
+    }
+
+    @Test
+    public void testUpdateCharacterStreamStringReaderLong() throws Exception {
+        try {
+            delegate.updateCharacterStream("foo", (java.io.StringReader) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateCharacterStream("foo", (java.io.StringReader) null, 1l);
+    }
+
+    @Test
+    public void testUpdateCharacterStreamIntegerReader() throws Exception {
+        try {
+            delegate.updateCharacterStream(1, (java.io.StringReader) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateCharacterStream(1, (java.io.StringReader) null);
+    }
+
+    @Test
+    public void testUpdateCharacterStreamStringReader() throws Exception {
+        try {
+            delegate.updateCharacterStream("foo", (java.io.StringReader) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateCharacterStream("foo", (java.io.StringReader) null);
+    }
+
+    @Test
+    public void testUpdateCharacterStreamStringReaderInteger() throws Exception {
+        try {
+            delegate.updateCharacterStream("foo", (java.io.StringReader) null, 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateCharacterStream("foo", (java.io.StringReader) null, 1);
+    }
+
+    @Test
+    public void testUpdateClobStringReaderLong() throws Exception {
+        try {
+            delegate.updateClob("foo", (java.io.StringReader) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateClob("foo", (java.io.StringReader) null, 1l);
+    }
+
+    @Test
+    public void testUpdateClobStringReader() throws Exception {
+        try {
+            delegate.updateClob("foo", (java.io.StringReader) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateClob("foo", (java.io.StringReader) null);
+    }
+
+    @Test
+    public void testUpdateClobIntegerReader() throws Exception {
+        try {
+            delegate.updateClob(1, (java.io.StringReader) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateClob(1, (java.io.StringReader) null);
+    }
+
+    @Test
+    public void testUpdateClobIntegerClob() throws Exception {
+        try {
+            delegate.updateClob(1, (java.sql.Clob) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateClob(1, (java.sql.Clob) null);
+    }
+
+    @Test
+    public void testUpdateClobStringClob() throws Exception {
+        try {
+            delegate.updateClob("foo", (java.sql.Clob) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateClob("foo", (java.sql.Clob) null);
+    }
+
+    @Test
+    public void testUpdateClobIntegerReaderLong() throws Exception {
+        try {
+            delegate.updateClob(1, (java.io.StringReader) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateClob(1, (java.io.StringReader) null, 1l);
+    }
+
+    @Test
+    public void testUpdateDateIntegerSqlDate() throws Exception {
+        try {
+            delegate.updateDate(1, new java.sql.Date(1529827548745l));
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateDate(1, new java.sql.Date(1529827548745l));
+    }
+
+    @Test
+    public void testUpdateDateStringSqlDate() throws Exception {
+        try {
+            delegate.updateDate("foo", new java.sql.Date(1529827548745l));
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateDate("foo", new java.sql.Date(1529827548745l));
+    }
+
+    @Test
+    public void testUpdateDoubleIntegerDouble() throws Exception {
+        try {
+            delegate.updateDouble(1, 1.0d);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateDouble(1, 1.0d);
+    }
+
+    @Test
+    public void testUpdateDoubleStringDouble() throws Exception {
+        try {
+            delegate.updateDouble("foo", 1.0d);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateDouble("foo", 1.0d);
+    }
+
+    @Test
+    public void testUpdateFloatStringFloat() throws Exception {
+        try {
+            delegate.updateFloat("foo", 1.0f);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateFloat("foo", 1.0f);
+    }
+
+    @Test
+    public void testUpdateFloatIntegerFloat() throws Exception {
+        try {
+            delegate.updateFloat(1, 1.0f);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateFloat(1, 1.0f);
+    }
+
+    @Test
+    public void testUpdateIntStringInteger() throws Exception {
+        try {
+            delegate.updateInt("foo", 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateInt("foo", 1);
+    }
+
+    @Test
+    public void testUpdateIntIntegerInteger() throws Exception {
+        try {
+            delegate.updateInt(1, 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateInt(1, 1);
+    }
+
+    @Test
+    public void testUpdateLongStringLong() throws Exception {
+        try {
+            delegate.updateLong("foo", 1l);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateLong("foo", 1l);
+    }
+
+    @Test
+    public void testUpdateLongIntegerLong() throws Exception {
+        try {
+            delegate.updateLong(1, 1l);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateLong(1, 1l);
+    }
+
+    @Test
+    public void testUpdateNCharacterStreamStringReader() throws Exception {
+        try {
+            delegate.updateNCharacterStream("foo", (java.io.StringReader) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateNCharacterStream("foo", (java.io.StringReader) null);
+    }
+
+    @Test
+    public void testUpdateNCharacterStreamIntegerReader() throws Exception {
+        try {
+            delegate.updateNCharacterStream(1, (java.io.StringReader) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateNCharacterStream(1, (java.io.StringReader) null);
+    }
+
+    @Test
+    public void testUpdateNCharacterStreamStringReaderLong() throws Exception {
+        try {
+            delegate.updateNCharacterStream("foo", (java.io.StringReader) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateNCharacterStream("foo", (java.io.StringReader) null, 1l);
+    }
+
+    @Test
+    public void testUpdateNCharacterStreamIntegerReaderLong() throws Exception {
+        try {
+            delegate.updateNCharacterStream(1, (java.io.StringReader) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateNCharacterStream(1, (java.io.StringReader) null, 1l);
+    }
+
+    @Test
+    public void testUpdateNClobStringNClob() throws Exception {
+        try {
+            delegate.updateNClob("foo", (java.sql.NClob) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateNClob("foo", (java.sql.NClob) null);
+    }
+
+    @Test
+    public void testUpdateNClobIntegerReaderLong() throws Exception {
+        try {
+            delegate.updateNClob(1, (java.io.StringReader) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateNClob(1, (java.io.StringReader) null, 1l);
+    }
+
+    @Test
+    public void testUpdateNClobIntegerNClob() throws Exception {
+        try {
+            delegate.updateNClob(1, (java.sql.NClob) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateNClob(1, (java.sql.NClob) null);
+    }
+
+    @Test
+    public void testUpdateNClobIntegerReader() throws Exception {
+        try {
+            delegate.updateNClob(1, (java.io.StringReader) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateNClob(1, (java.io.StringReader) null);
+    }
+
+    @Test
+    public void testUpdateNClobStringReaderLong() throws Exception {
+        try {
+            delegate.updateNClob("foo", (java.io.StringReader) null, 1l);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateNClob("foo", (java.io.StringReader) null, 1l);
+    }
+
+    @Test
+    public void testUpdateNClobStringReader() throws Exception {
+        try {
+            delegate.updateNClob("foo", (java.io.StringReader) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateNClob("foo", (java.io.StringReader) null);
+    }
+
+    @Test
+    public void testUpdateNStringIntegerString() throws Exception {
+        try {
+            delegate.updateNString(1, "foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateNString(1, "foo");
+    }
+
+    @Test
+    public void testUpdateNStringStringString() throws Exception {
+        try {
+            delegate.updateNString("foo", "foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateNString("foo", "foo");
+    }
+
+    @Test
+    public void testUpdateNullInteger() throws Exception {
+        try {
+            delegate.updateNull(1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateNull(1);
+    }
+
+    @Test
+    public void testUpdateNullString() throws Exception {
+        try {
+            delegate.updateNull("foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateNull("foo");
+    }
+
+    @Test
+    public void testUpdateObjectStringObjectSQLType() throws Exception {
+        try {
+            delegate.updateObject("foo", System.err, (java.sql.SQLType) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateObject("foo", System.err, (java.sql.SQLType) null);
+    }
+
+    @Test
+    public void testUpdateObjectStringObjectSQLTypeInteger() throws Exception {
+        try {
+            delegate.updateObject("foo", System.err, (java.sql.SQLType) null, 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateObject("foo", System.err, (java.sql.SQLType) null, 1);
+    }
+
+    @Test
+    public void testUpdateObjectIntegerObject() throws Exception {
+        try {
+            delegate.updateObject(1, System.err);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateObject(1, System.err);
+    }
+
+    @Test
+    public void testUpdateObjectIntegerObjectSQLTypeInteger() throws Exception {
+        try {
+            delegate.updateObject(1, System.err, (java.sql.SQLType) null, 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateObject(1, System.err, (java.sql.SQLType) null, 1);
+    }
+
+    // FIXME this appears to be a bug
+    @Ignore
+    @Test
+    public void testUpdateObjectStringObjectInteger() throws Exception {
+        try {
+            delegate.updateObject("foo", System.err, 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateObject("foo", System.err, 1);
+    }
+
+    // FIXME: this appears to be a bug
+    @Ignore
+    @Test
+    public void testUpdateObjectIntegerObjectInteger() throws Exception {
+        try {
+            delegate.updateObject(1, System.err, 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateObject(1, System.err, 1);
+    }
+
+    @Test
+    public void testUpdateObjectStringObject() throws Exception {
+        try {
+            delegate.updateObject("foo", System.err);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateObject("foo", System.err);
+    }
+
+    @Test
+    public void testUpdateObjectIntegerObjectSQLType() throws Exception {
+        try {
+            delegate.updateObject(1, System.err, (java.sql.SQLType) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateObject(1, System.err, (java.sql.SQLType) null);
+    }
+
+    @Test
+    public void testUpdateRefIntegerRef() throws Exception {
+        try {
+            delegate.updateRef(1, (java.sql.Ref) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateRef(1, (java.sql.Ref) null);
+    }
+
+    @Test
+    public void testUpdateRefStringRef() throws Exception {
+        try {
+            delegate.updateRef("foo", (java.sql.Ref) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateRef("foo", (java.sql.Ref) null);
+    }
+
+    @Test
+    public void testUpdateRow() throws Exception {
+        try {
+            delegate.updateRow();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateRow();
+    }
+
+    @Test
+    public void testUpdateRowIdStringRowId() throws Exception {
+        try {
+            delegate.updateRowId("foo", (java.sql.RowId) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateRowId("foo", (java.sql.RowId) null);
+    }
+
+    @Test
+    public void testUpdateRowIdIntegerRowId() throws Exception {
+        try {
+            delegate.updateRowId(1, (java.sql.RowId) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateRowId(1, (java.sql.RowId) null);
+    }
+
+    @Test
+    public void testUpdateSQLXMLIntegerSQLXML() throws Exception {
+        try {
+            delegate.updateSQLXML(1, (java.sql.SQLXML) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateSQLXML(1, (java.sql.SQLXML) null);
+    }
+
+    @Test
+    public void testUpdateSQLXMLStringSQLXML() throws Exception {
+        try {
+            delegate.updateSQLXML("foo", (java.sql.SQLXML) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateSQLXML("foo", (java.sql.SQLXML) null);
+    }
+
+    @Test
+    public void testUpdateShortIntegerShort() throws Exception {
+        try {
+            delegate.updateShort(1, (short) 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateShort(1, (short) 1);
+    }
+
+    @Test
+    public void testUpdateShortStringShort() throws Exception {
+        try {
+            delegate.updateShort("foo", (short) 1);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateShort("foo", (short) 1);
+    }
+
+    @Test
+    public void testUpdateStringIntegerString() throws Exception {
+        try {
+            delegate.updateString(1, "foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateString(1, "foo");
+    }
+
+    @Test
+    public void testUpdateStringStringString() throws Exception {
+        try {
+            delegate.updateString("foo", "foo");
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateString("foo", "foo");
+    }
+
+    @Test
+    public void testUpdateTimeStringTime() throws Exception {
+        try {
+            delegate.updateTime("foo", (java.sql.Time) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateTime("foo", (java.sql.Time) null);
+    }
+
+    @Test
+    public void testUpdateTimeIntegerTime() throws Exception {
+        try {
+            delegate.updateTime(1, (java.sql.Time) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateTime(1, (java.sql.Time) null);
+    }
+
+    @Test
+    public void testUpdateTimestampIntegerTimestamp() throws Exception {
+        try {
+            delegate.updateTimestamp(1, (java.sql.Timestamp) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateTimestamp(1, (java.sql.Timestamp) null);
+    }
+
+    @Test
+    public void testUpdateTimestampStringTimestamp() throws Exception {
+        try {
+            delegate.updateTimestamp("foo", (java.sql.Timestamp) null);
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).updateTimestamp("foo", (java.sql.Timestamp) null);
+    }
+
+    @Test
+    public void testWasNull() throws Exception {
+        try {
+            delegate.wasNull();
+        } catch (SQLException e) {
+        }
+        verify(rs, times(1)).wasNull();
+    }
+
+    @Test
+    public void testToString() {
+        String toString = delegate.toString();
+        assertTrue(toString.contains("DelegatingResultSet"));
+        assertTrue(toString.contains("Mock for ResultSet"));
+    }
+
+    @Test
+    public void testWrap() throws SQLException {
+        DelegatingResultSet delegate = (DelegatingResultSet) DelegatingResultSet.wrapResultSet(conn, rs);
+        assertEquals(delegate, delegate.unwrap(ResultSet.class));
+        assertEquals(delegate, delegate.unwrap(DelegatingResultSet.class));
+        assertEquals(rs, delegate.unwrap(rs.getClass()));
+        assertNull(delegate.unwrap(String.class));
+        assertTrue(delegate.isWrapperFor(ResultSet.class));
+        assertTrue(delegate.isWrapperFor(DelegatingResultSet.class));
+        assertTrue(delegate.isWrapperFor(rs.getClass()));
+        assertFalse(delegate.isWrapperFor(String.class));
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/TestDelegatingStatement.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/TestDelegatingStatement.java b/src/test/java/org/apache/commons/dbcp2/TestDelegatingStatement.java
index cbed0d1..a12dd2e 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestDelegatingStatement.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestDelegatingStatement.java
@@ -22,6 +22,9 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
 
 import java.lang.reflect.Proxy;
 import java.sql.Connection;
@@ -31,39 +34,37 @@ import java.sql.Statement;
 import org.junit.Before;
 import org.junit.Test;
 
-/**
- */
 public class TestDelegatingStatement {
 
     private DelegatingConnection<Connection> conn = null;
     private Connection delegateConn = null;
-    private DelegatingStatement stmt = null;
-    private Statement delegateStmt = null;
+    private Statement obj = null;
+    private DelegatingStatement delegate = null;
 
     @Before
     public void setUp() throws Exception {
         delegateConn = new TesterConnection("test", "test");
-        delegateStmt = new TesterStatement(delegateConn);
         conn = new DelegatingConnection<>(delegateConn);
-        stmt = new DelegatingStatement(conn,delegateStmt);
+        obj = mock(Statement.class);
+        delegate = new DelegatingStatement(conn, obj);
     }
 
     @Test
     public void testExecuteQueryReturnsNull() throws Exception {
-        assertNull(stmt.executeQuery("null"));
+        assertNull(delegate.executeQuery("null"));
     }
 
     @Test
     public void testGetDelegate() throws Exception {
-        assertEquals(delegateStmt,stmt.getDelegate());
+        assertEquals(obj,delegate.getDelegate());
     }
 
     @Test
     public void testCheckOpen() throws Exception {
-        stmt.checkOpen();
-        stmt.close();
+        delegate.checkOpen();
+        delegate.close();
         try {
-            stmt.checkOpen();
+            delegate.checkOpen();
             fail("Expecting SQLException");
         } catch (final SQLException ex) {
             // expected
@@ -99,4 +100,478 @@ public class TestDelegatingStatement {
             return false;
         }
     }
+
+    @Test
+    public void testAddBatchString() throws Exception {
+        try {
+            delegate.addBatch("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).addBatch("foo");
+    }
+
+    @Test
+    public void testCancel() throws Exception {
+        try {
+            delegate.cancel();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).cancel();
+    }
+
+    @Test
+    public void testClearBatch() throws Exception {
+        try {
+            delegate.clearBatch();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).clearBatch();
+    }
+
+    @Test
+    public void testClearWarnings() throws Exception {
+        try {
+            delegate.clearWarnings();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).clearWarnings();
+    }
+
+    @Test
+    public void testClose() throws Exception {
+        try {
+            delegate.close();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).close();
+    }
+
+    @Test
+    public void testCloseOnCompletion() throws Exception {
+        try {
+            delegate.closeOnCompletion();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).closeOnCompletion();
+    }
+
+    @Test
+    public void testExecuteStringIntegerArray() throws Exception {
+        try {
+            delegate.execute("foo", (int[]) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).execute("foo", (int[]) null);
+    }
+
+    @Test
+    public void testExecuteString() throws Exception {
+        try {
+            delegate.execute("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).execute("foo");
+    }
+
+    @Test
+    public void testExecuteStringStringArray() throws Exception {
+        try {
+            delegate.execute("foo", (String[]) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).execute("foo", (String[]) null);
+    }
+
+    @Test
+    public void testExecuteStringInteger() throws Exception {
+        try {
+            delegate.execute("foo", 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).execute("foo", 1);
+    }
+
+    @Test
+    public void testExecuteBatch() throws Exception {
+        try {
+            delegate.executeBatch();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).executeBatch();
+    }
+
+    @Test
+    public void testExecuteLargeBatch() throws Exception {
+        try {
+            delegate.executeLargeBatch();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).executeLargeBatch();
+    }
+
+    @Test
+    public void testExecuteLargeUpdateStringInteger() throws Exception {
+        try {
+            delegate.executeLargeUpdate("foo", 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).executeLargeUpdate("foo", 1);
+    }
+
+    @Test
+    public void testExecuteLargeUpdateStringIntegerArray() throws Exception {
+        try {
+            delegate.executeLargeUpdate("foo", (int[]) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).executeLargeUpdate("foo", (int[]) null);
+    }
+
+    @Test
+    public void testExecuteLargeUpdateString() throws Exception {
+        try {
+            delegate.executeLargeUpdate("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).executeLargeUpdate("foo");
+    }
+
+    @Test
+    public void testExecuteLargeUpdateStringStringArray() throws Exception {
+        try {
+            delegate.executeLargeUpdate("foo", (String[]) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).executeLargeUpdate("foo", (String[]) null);
+    }
+
+    @Test
+    public void testExecuteQueryString() throws Exception {
+        try {
+            delegate.executeQuery("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).executeQuery("foo");
+    }
+
+    @Test
+    public void testExecuteUpdateStringIntegerArray() throws Exception {
+        try {
+            delegate.executeUpdate("foo", (int[]) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).executeUpdate("foo", (int[]) null);
+    }
+
+    @Test
+    public void testExecuteUpdateStringStringArray() throws Exception {
+        try {
+            delegate.executeUpdate("foo", (String[]) null);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).executeUpdate("foo", (String[]) null);
+    }
+
+    @Test
+    public void testExecuteUpdateString() throws Exception {
+        try {
+            delegate.executeUpdate("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).executeUpdate("foo");
+    }
+
+    @Test
+    public void testExecuteUpdateStringInteger() throws Exception {
+        try {
+            delegate.executeUpdate("foo", 1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).executeUpdate("foo", 1);
+    }
+
+    /**
+     * This method is a bit special, and return the delegate connection, not the
+     * wrapped statement's connection.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testGetConnection() throws Exception {
+        try {
+            delegate.getConnection();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(0)).getConnection();
+    }
+
+    @Test
+    public void testGetFetchDirection() throws Exception {
+        try {
+            delegate.getFetchDirection();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getFetchDirection();
+    }
+
+    @Test
+    public void testGetFetchSize() throws Exception {
+        try {
+            delegate.getFetchSize();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getFetchSize();
+    }
+
+    @Test
+    public void testGetGeneratedKeys() throws Exception {
+        try {
+            delegate.getGeneratedKeys();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getGeneratedKeys();
+    }
+
+    @Test
+    public void testGetLargeMaxRows() throws Exception {
+        try {
+            delegate.getLargeMaxRows();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getLargeMaxRows();
+    }
+
+    @Test
+    public void testGetLargeUpdateCount() throws Exception {
+        try {
+            delegate.getLargeUpdateCount();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getLargeUpdateCount();
+    }
+
+    @Test
+    public void testGetMaxFieldSize() throws Exception {
+        try {
+            delegate.getMaxFieldSize();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getMaxFieldSize();
+    }
+
+    @Test
+    public void testGetMaxRows() throws Exception {
+        try {
+            delegate.getMaxRows();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getMaxRows();
+    }
+
+    @Test
+    public void testGetMoreResultsInteger() throws Exception {
+        try {
+            delegate.getMoreResults(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getMoreResults(1);
+    }
+
+    @Test
+    public void testGetMoreResults() throws Exception {
+        try {
+            delegate.getMoreResults();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getMoreResults();
+    }
+
+    @Test
+    public void testGetQueryTimeout() throws Exception {
+        try {
+            delegate.getQueryTimeout();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getQueryTimeout();
+    }
+
+    @Test
+    public void testGetResultSet() throws Exception {
+        try {
+            delegate.getResultSet();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getResultSet();
+    }
+
+    @Test
+    public void testGetResultSetConcurrency() throws Exception {
+        try {
+            delegate.getResultSetConcurrency();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getResultSetConcurrency();
+    }
+
+    @Test
+    public void testGetResultSetHoldability() throws Exception {
+        try {
+            delegate.getResultSetHoldability();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getResultSetHoldability();
+    }
+
+    @Test
+    public void testGetResultSetType() throws Exception {
+        try {
+            delegate.getResultSetType();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getResultSetType();
+    }
+
+    @Test
+    public void testGetUpdateCount() throws Exception {
+        try {
+            delegate.getUpdateCount();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getUpdateCount();
+    }
+
+    @Test
+    public void testGetWarnings() throws Exception {
+        try {
+            delegate.getWarnings();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).getWarnings();
+    }
+
+    @Test
+    public void testIsCloseOnCompletion() throws Exception {
+        try {
+            delegate.isCloseOnCompletion();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).isCloseOnCompletion();
+    }
+
+    /**
+     * This method is a bit special, and call isClosed in the delegate object
+     * itself, not in the wrapped statement.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testIsClosed() throws Exception {
+        try {
+            delegate.isClosed();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(0)).isClosed();
+    }
+
+    @Test
+    public void testIsPoolable() throws Exception {
+        try {
+            delegate.isPoolable();
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).isPoolable();
+    }
+
+    @Test
+    public void testSetCursorNameString() throws Exception {
+        try {
+            delegate.setCursorName("foo");
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setCursorName("foo");
+    }
+
+    @Test
+    public void testSetEscapeProcessingBoolean() throws Exception {
+        try {
+            delegate.setEscapeProcessing(Boolean.TRUE);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setEscapeProcessing(Boolean.TRUE);
+    }
+
+    @Test
+    public void testSetFetchDirectionInteger() throws Exception {
+        try {
+            delegate.setFetchDirection(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setFetchDirection(1);
+    }
+
+    @Test
+    public void testSetFetchSizeInteger() throws Exception {
+        try {
+            delegate.setFetchSize(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setFetchSize(1);
+    }
+
+    @Test
+    public void testSetLargeMaxRowsLong() throws Exception {
+        try {
+            delegate.setLargeMaxRows(1l);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setLargeMaxRows(1l);
+    }
+
+    @Test
+    public void testSetMaxFieldSizeInteger() throws Exception {
+        try {
+            delegate.setMaxFieldSize(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setMaxFieldSize(1);
+    }
+
+    @Test
+    public void testSetMaxRowsInteger() throws Exception {
+        try {
+            delegate.setMaxRows(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setMaxRows(1);
+    }
+
+    @Test
+    public void testSetPoolableBoolean() throws Exception {
+        try {
+            delegate.setPoolable(Boolean.TRUE);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setPoolable(Boolean.TRUE);
+    }
+
+    @Test
+    public void testSetQueryTimeoutInteger() throws Exception {
+        try {
+            delegate.setQueryTimeout(1);
+        } catch (SQLException e) {
+        }
+        verify(obj, times(1)).setQueryTimeout(1);
+    }
+
+    @Test
+    public void testWrap() throws SQLException {
+        assertEquals(delegate, delegate.unwrap(Statement.class));
+        assertEquals(delegate, delegate.unwrap(DelegatingStatement.class));
+        assertEquals(obj, delegate.unwrap(obj.getClass()));
+        assertNull(delegate.unwrap(String.class));
+        assertTrue(delegate.isWrapperFor(Statement.class));
+        assertTrue(delegate.isWrapperFor(DelegatingStatement.class));
+        assertTrue(delegate.isWrapperFor(obj.getClass()));
+        assertFalse(delegate.isWrapperFor(String.class));
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/TestDriverConnectionFactory.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/TestDriverConnectionFactory.java b/src/test/java/org/apache/commons/dbcp2/TestDriverConnectionFactory.java
new file mode 100644
index 0000000..78a5988
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbcp2/TestDriverConnectionFactory.java
@@ -0,0 +1,48 @@
+/*
+ * 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.commons.dbcp2;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import org.junit.Test;
+
+/**
+ * Tests for DriverConnectionFactory.
+ */
+public class TestDriverConnectionFactory {
+
+    @Test
+    public void testDriverConnectionFactoryToString() {
+        DriverConnectionFactory cf = new DriverConnectionFactory(
+                new TesterDriver(), "jdbc:apache:commons:testdriver", null);
+        String toString = cf.toString();
+        assertTrue(toString.contains("jdbc:apache:commons:testdriver"));
+    }
+
+    @Test
+    public void testCreateConnection() throws SQLException {
+        DriverConnectionFactory cf = new DriverConnectionFactory(
+                new TesterDriver(), "jdbc:apache:commons:testdriver", null);
+        Connection conn = cf.createConnection();
+        assertEquals(0, conn.getMetaData().getDriverMajorVersion());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java b/src/test/java/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java
index 98c3f73..31de811 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java
@@ -20,6 +20,7 @@ package org.apache.commons.dbcp2;
 import static org.junit.Assert.fail;
 
 import java.sql.Connection;
+import java.sql.SQLException;
 import java.util.Properties;
 
 import javax.sql.DataSource;
@@ -66,6 +67,30 @@ public class TestDriverManagerConnectionFactory {
         testDriverManagerInit(false);
     }
 
+    @Test(expected=IndexOutOfBoundsException.class) // thrown by TestDriver due to missing user
+    public void testDriverManagerWithoutUser() throws SQLException {
+        DriverManagerConnectionFactory cf = new DriverManagerConnectionFactory("jdbc:apache:commons:testdriver", null, "pass");
+        cf.createConnection();
+    }
+
+    @Test(expected=SQLException.class) // thrown by TestDriver due to invalid password
+    public void testDriverManagerWithoutPassword() throws SQLException {
+        DriverManagerConnectionFactory cf = new DriverManagerConnectionFactory("jdbc:apache:commons:testdriver", "user", null);
+        cf.createConnection();
+    }
+
+    @Test(expected=ArrayIndexOutOfBoundsException.class) // thrown by TestDriver due to missing user
+    public void testDriverManagerWithoutCredentials() throws SQLException {
+        DriverManagerConnectionFactory cf = new DriverManagerConnectionFactory("jdbc:apache:commons:testdriver", null,  null);
+        cf.createConnection();
+    }
+
+    @Test
+    public void testDriverManagerCredentialsInUrl() throws SQLException {
+        DriverManagerConnectionFactory cf = new DriverManagerConnectionFactory("jdbc:apache:commons:testdriver;user=foo;password=bar", null,  null);
+        cf.createConnection();
+    }
+
     public void testDriverManagerInit(final boolean withProperties) throws Exception {
         final GenericObjectPoolConfig config = new GenericObjectPoolConfig();
         config.setMaxTotal(10);

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/TestLifetimeExceededException.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/TestLifetimeExceededException.java b/src/test/java/org/apache/commons/dbcp2/TestLifetimeExceededException.java
new file mode 100644
index 0000000..69ae9df
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbcp2/TestLifetimeExceededException.java
@@ -0,0 +1,41 @@
+/*
+ * 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.commons.dbcp2;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+
+/**
+ * Tests for LifetimeExceededException.
+ */
+public class TestLifetimeExceededException {
+
+    @Test
+    public void testLifetimeExceededExceptionNoMessage() {
+        LifetimeExceededException exception = new LifetimeExceededException();
+        assertNull(exception.getMessage());
+    }
+
+    @Test
+    public void testLifetimeExceededException() {
+        LifetimeExceededException exception = new LifetimeExceededException("car");
+        assertEquals("car", exception.getMessage());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/TestListException.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/TestListException.java b/src/test/java/org/apache/commons/dbcp2/TestListException.java
new file mode 100644
index 0000000..de24e8f
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbcp2/TestListException.java
@@ -0,0 +1,50 @@
+/*
+ * 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.commons.dbcp2;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.util.List;
+
+import org.junit.Test;
+
+import edu.emory.mathcs.backport.java.util.Arrays;
+
+/**
+ * Tests for ListException.
+ */
+public class TestListException {
+
+    @Test
+    public void testNulls() {
+        ListException list = new ListException(null, null);
+        assertNull(list.getMessage());
+        assertNull(list.getExceptionList());
+    }
+
+    @Test
+    public void testExceptionList() {
+        @SuppressWarnings("unchecked")
+        List<Throwable> exceptions = Arrays.asList(new Throwable[] {new NullPointerException(), new RuntimeException()});
+        ListException list = new ListException("Internal Error", exceptions);
+        assertEquals("Internal Error", list.getMessage());
+        assertArrayEquals(exceptions.toArray(), list.getExceptionList().toArray());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/TestPStmtKey.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/TestPStmtKey.java b/src/test/java/org/apache/commons/dbcp2/TestPStmtKey.java
index 2cdd932..a1002e8 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestPStmtKey.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestPStmtKey.java
@@ -16,8 +16,16 @@
  */
 package org.apache.commons.dbcp2;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Statement;
 import java.util.Arrays;
 
+import javax.resource.cci.ResultSet;
+
 import org.apache.commons.dbcp2.PoolingConnection.StatementType;
 import org.junit.Assert;
 import org.junit.Test;
@@ -196,4 +204,61 @@ public class TestPStmtKey {
         input[1] = "D";
         Assert.assertFalse(Arrays.equals(input, pStmtKey.getColumnNames()));
     }
+
+    @Test
+    public void testGettersSetters() {
+        final PStmtKey pStmtKey = new PStmtKey("SELECT 1", "catalog", "public");
+        assertEquals("SELECT 1", pStmtKey.getSql());
+        assertEquals("public", pStmtKey.getSchema());
+        assertEquals("catalog", pStmtKey.getCatalog());
+        assertNull(pStmtKey.getAutoGeneratedKeys());
+        assertNull(pStmtKey.getResultSetConcurrency());
+        assertNull(pStmtKey.getResultSetHoldability());
+        assertNull(pStmtKey.getResultSetType());
+        assertEquals(StatementType.PREPARED_STATEMENT, pStmtKey.getStmtType());
+    }
+
+    @Test
+    public void testEquals() {
+        final PStmtKey pStmtKey = new PStmtKey("SELECT 1", "catalog", "public",
+                ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY,
+                StatementType.CALLABLE_STATEMENT);
+        assertTrue(pStmtKey.equals(pStmtKey));
+        assertFalse(pStmtKey.equals(null));
+        assertFalse(pStmtKey.equals(new Object()));
+        assertFalse(pStmtKey.equals(new PStmtKey("SELECT 2", "catalog", "public",
+                ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY,
+                StatementType.CALLABLE_STATEMENT)));
+        assertFalse(pStmtKey.equals(new PStmtKey("SELECT 1", "anothercatalog", "public",
+                ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY,
+                StatementType.CALLABLE_STATEMENT)));
+        assertFalse(pStmtKey.equals(new PStmtKey("SELECT 1", "catalog", "private",
+                ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY,
+                StatementType.CALLABLE_STATEMENT)));
+        assertFalse(pStmtKey.equals(new PStmtKey("SELECT 1", "catalog", "public",
+                ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY,
+                StatementType.CALLABLE_STATEMENT)));
+        assertFalse(pStmtKey.equals(new PStmtKey("SELECT 1", "catalog", "public",
+                ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE,
+                StatementType.CALLABLE_STATEMENT)));
+        assertFalse(pStmtKey.equals(new PStmtKey("SELECT 1", "catalog", "public",
+                ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY,
+                StatementType.PREPARED_STATEMENT)));
+        assertTrue(pStmtKey.equals(new PStmtKey("SELECT 1", "catalog", "public",
+                ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY,
+                StatementType.CALLABLE_STATEMENT)));
+        assertEquals(pStmtKey.hashCode(), new PStmtKey("SELECT 1", "catalog", "public",
+                ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY,
+                StatementType.CALLABLE_STATEMENT).hashCode());
+    }
+
+    @Test
+    public void testToString() {
+        final PStmtKey pStmtKey = new PStmtKey("SELECT 1", "catalog", "public",
+                StatementType.CALLABLE_STATEMENT, Statement.RETURN_GENERATED_KEYS);
+        assertTrue(pStmtKey.toString().contains("sql=SELECT 1"));
+        assertTrue(pStmtKey.toString().contains("schema=public"));
+        assertTrue(pStmtKey.toString().contains("autoGeneratedKeys=1"));
+        assertTrue(pStmtKey.toString().contains("statementType=CALLABLE_STATEMENT"));
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java b/src/test/java/org/apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java
index 8099dc2..a3e0f4e 100644
--- a/src/test/java/org/apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java
+++ b/src/test/java/org/apache/commons/dbcp2/cpdsadapter/TestDriverAdapterCPDS.java
@@ -17,17 +17,24 @@
 
 package org.apache.commons.dbcp2.cpdsadapter;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.util.Properties;
+import java.io.PrintWriter;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
 
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.naming.StringRefAddr;
 import javax.sql.DataSource;
 
 import org.apache.commons.dbcp2.datasources.SharedPoolDataSource;
@@ -148,6 +155,7 @@ public class TestDriverAdapterCPDS {
         // This will overwrite field value
         final Properties properties = new Properties();
         properties.put("user", "foo");
+        properties.put("password", pcds.getPassword());
         pcds.setConnectionProperties(properties);
         pcds.getPooledConnection().close();
         assertEquals("foo", pcds.getUser());
@@ -161,6 +169,14 @@ public class TestDriverAdapterCPDS {
         assertEquals("bar", pcds.getConnectionProperties().getProperty("password"));
     }
 
+    @Test(expected=IllegalStateException.class)
+    public void testSetConnectionPropertiesConnectionCalled() throws Exception {
+        final Properties properties = new Properties();
+        // call to the connection
+        pcds.getPooledConnection().close();
+        pcds.setConnectionProperties(properties);
+    }
+
     @Test
     public void testSetConnectionPropertiesNull() throws Exception {
         pcds.setConnectionProperties(null);
@@ -275,4 +291,68 @@ public class TestDriverAdapterCPDS {
             return failed;
         }
     }
+
+    @Test(expected=SQLFeatureNotSupportedException.class)
+    public void testGetParentLogger() throws SQLFeatureNotSupportedException {
+        pcds.getParentLogger();
+    }
+
+    @Test
+    public void testGetReference() throws NamingException {
+        Reference ref = pcds.getReference();
+        assertEquals(pcds.getDriver(), ref.get("driver").getContent());
+        assertEquals(pcds.getDescription(), ref.get("description").getContent());
+    }
+
+    @Test
+    public void testGettersAndSetters() {
+        pcds.setUser("foo");
+        assertEquals("foo", pcds.getUser());
+        pcds.setPassword("bar");
+        assertEquals("bar", pcds.getPassword());
+        pcds.setPassword(new char[] {'a', 'b'});
+        assertArrayEquals(new char[] {'a', 'b'}, pcds.getPasswordCharArray());
+        PrintWriter pw = new PrintWriter(System.err);
+        pcds.setLogWriter(pw);
+        assertEquals(pw, pcds.getLogWriter());
+        pcds.setLoginTimeout(10);
+        assertEquals(10, pcds.getLoginTimeout());
+        pcds.setMaxIdle(100);
+        assertEquals(100, pcds.getMaxIdle());
+        pcds.setTimeBetweenEvictionRunsMillis(100);
+        assertEquals(100, pcds.getTimeBetweenEvictionRunsMillis());
+        pcds.setNumTestsPerEvictionRun(1);
+        assertEquals(1, pcds.getNumTestsPerEvictionRun());
+        pcds.setMinEvictableIdleTimeMillis(11);
+        assertEquals(11, pcds.getMinEvictableIdleTimeMillis());
+        pcds.setDescription("jo");
+        assertEquals("jo", pcds.getDescription());
+    }
+
+    @Test
+    public void testGetObjectInstanceNull() throws Exception {
+        Object o = pcds.getObjectInstance(null, null, null, null);
+        assertNull(o);
+    }
+
+    @Test
+    public void testGetObjectInstance() throws Exception {
+        Reference ref = pcds.getReference();
+        Object o = pcds.getObjectInstance(ref, null, null, null);
+        assertEquals(pcds.getDriver(), ((DriverAdapterCPDS) o).getDriver());
+    }
+
+    @Test
+    public void testGetObjectInstanceChangeDescription() throws Exception {
+        Reference ref = pcds.getReference();
+        for (int i = 0; i < ref.size(); i++) {
+            if (ref.get(i).getType().equals("description")) {
+                ref.remove(i);
+                break;
+            }
+        }
+        ref.add(new StringRefAddr("description", "anything"));
+        Object o = pcds.getObjectInstance(ref, null, null, null);
+        assertEquals(pcds.getDescription(), ((DriverAdapterCPDS) o).getDescription());
+    }
 }


[2/5] commons-dbcp git commit: [DBCP-504] Increase test coverage. Closes #13.

Posted by gg...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/datasources/TestInstanceKeyDataSource.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/datasources/TestInstanceKeyDataSource.java b/src/test/java/org/apache/commons/dbcp2/datasources/TestInstanceKeyDataSource.java
index 654a677..1a875d0 100644
--- a/src/test/java/org/apache/commons/dbcp2/datasources/TestInstanceKeyDataSource.java
+++ b/src/test/java/org/apache/commons/dbcp2/datasources/TestInstanceKeyDataSource.java
@@ -18,37 +18,63 @@
 package org.apache.commons.dbcp2.datasources;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.io.PrintWriter;
 import java.sql.Connection;
 import java.sql.SQLException;
+import java.util.Properties;
 
 import org.apache.commons.dbcp2.cpdsadapter.DriverAdapterCPDS;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 
 /**
  */
 public class TestInstanceKeyDataSource {
 
+    private DriverAdapterCPDS pcds;
+    private SharedPoolDataSource spds;
+
+    private final static String DRIVER = "org.apache.commons.dbcp2.TesterDriver";
+    private final static String URL = "jdbc:apache:commons:testdriver";
+    private final static String USER = "foo";
+    private final static String PASS = "bar";
+
+    @Before
+    public void setUp() throws ClassNotFoundException {
+        pcds = new DriverAdapterCPDS();
+        pcds.setDriver(DRIVER);
+        pcds.setUrl(URL);
+        pcds.setUser(USER);
+        pcds.setPassword(PASS);
+        pcds.setPoolPreparedStatements(false);
+        spds = new SharedPoolDataSource();
+        spds.setConnectionPoolDataSource(pcds);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        spds.close();
+    }
+
     /**
      * Verify that exception on setupDefaults does not leak PooledConnection
      *
      * JIRA: DBCP-237
+     * @throws Exception
      */
     @Test
     public void testExceptionOnSetupDefaults() throws Exception {
-        DriverAdapterCPDS pcds;
-        pcds = new DriverAdapterCPDS();
-        pcds.setDriver("org.apache.commons.dbcp2.TesterDriver");
-        pcds.setUrl("jdbc:apache:commons:testdriver");
-        pcds.setUser("foo");
-        pcds.setPassword("bar");
-        pcds.setPoolPreparedStatements(false);
-        final ThrowOnSetupDefaultsDataSource tds = new ThrowOnSetupDefaultsDataSource();
-        tds.setConnectionPoolDataSource(pcds);
+        ThrowOnSetupDefaultsDataSource tds = new ThrowOnSetupDefaultsDataSource();
         final int numConnections = tds.getNumActive();
         try {
-            tds.getConnection("foo", "bar");
+            tds.getConnection(USER, PASS);
             fail("Expecting SQLException");
         } catch (final SQLException ex) {
            //Expected
@@ -71,4 +97,215 @@ public class TestInstanceKeyDataSource {
         }
     }
 
+    @Test
+    public void testConnectionPoolDataSource() {
+        assertEquals(pcds, spds.getConnectionPoolDataSource());
+    }
+
+    @Test(expected=IllegalStateException.class)
+    public void testConnectionPoolDataSourceAlreadySet() {
+        spds.setConnectionPoolDataSource(new DriverAdapterCPDS());
+    }
+
+    @Test(expected=IllegalStateException.class)
+    public void testConnectionPoolDataSourceAlreadySetUsingJndi() {
+        spds = new SharedPoolDataSource();
+        spds.setDataSourceName("anything");
+        spds.setConnectionPoolDataSource(new DriverAdapterCPDS());
+    }
+
+    @Test
+    public void testDataSourceName() {
+        spds = new SharedPoolDataSource();
+        assertNull(spds.getDataSourceName());
+        spds.setDataSourceName("anything");
+        assertEquals("anything", spds.getDataSourceName());
+    }
+
+    @Test(expected=IllegalStateException.class)
+    public void testDataSourceNameAlreadySet() {
+        spds.setDataSourceName("anything");
+    }
+
+    @Test(expected=IllegalStateException.class)
+    public void testDataSourceNameAlreadySetUsingJndi() {
+        spds = new SharedPoolDataSource();
+        spds.setDataSourceName("anything");
+        spds.setDataSourceName("anything");
+    }
+
+    @Test
+    public void testDefaultTransactionIsolation() {
+        assertEquals(SharedPoolDataSource.UNKNOWN_TRANSACTIONISOLATION, spds.getDefaultTransactionIsolation());
+        spds.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
+        assertEquals(Connection.TRANSACTION_READ_COMMITTED, spds.getDefaultTransactionIsolation());
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testDefaultTransactionIsolationInvalid() {
+        assertEquals(SharedPoolDataSource.UNKNOWN_TRANSACTIONISOLATION, spds.getDefaultTransactionIsolation());
+        spds.setDefaultTransactionIsolation(Integer.MAX_VALUE);
+    }
+
+    @Test
+    public void testDescription() {
+        spds.setDescription("anything");
+        assertEquals("anything", spds.getDescription());
+    }
+
+    @Test(expected=NullPointerException.class)
+    public void testJndiNullProperties() {
+        spds.setJndiEnvironment(null);
+    }
+
+    @Test
+    public void testJndiPropertiesNotInitialized() {
+        assertNull(spds.getJndiEnvironment("name"));
+        spds.setJndiEnvironment("name", "king");
+        assertEquals("king", spds.getJndiEnvironment("name"));
+    }
+
+    @Test
+    public void testJndiPropertiesCleared() {
+        spds.setJndiEnvironment("name", "king");
+        assertEquals("king", spds.getJndiEnvironment("name"));
+        Properties properties = new Properties();
+        properties.setProperty("fish", "kohi");
+        spds.setJndiEnvironment(properties);
+        assertNull(spds.getJndiEnvironment("name"));
+    }
+
+    @Test
+    public void testJndiEnvironment() {
+        assertNull(spds.getJndiEnvironment("name"));
+        Properties properties = new Properties();
+        properties.setProperty("name", "clarke");
+        spds.setJndiEnvironment(properties);
+        assertEquals("clarke", spds.getJndiEnvironment("name"));
+        spds.setJndiEnvironment("name", "asimov");
+        assertEquals("asimov", spds.getJndiEnvironment("name"));
+    }
+
+    @Test
+    public void testLoginTimeout() {
+        spds.setLoginTimeout(10);
+        assertEquals(10, spds.getLoginTimeout());
+    }
+
+    @Test
+    public void testLogWriterAutoInitialized() {
+        assertNotNull(spds.getLogWriter());
+    }
+
+    @Test
+    public void testLogWriter() {
+        spds.setLogWriter(new PrintWriter(System.out));
+        assertNotNull(spds.getLogWriter());
+    }
+
+    @Test
+    public void testValidationQuery() {
+        assertNull(spds.getValidationQuery());
+        spds.setValidationQuery("anything");
+        assertEquals("anything", spds.getValidationQuery());
+    }
+
+    @Test(expected=IllegalStateException.class)
+    public void testValidationQueryWithConnectionCalled() throws SQLException {
+        spds.getConnection();
+        assertNull(spds.getValidationQuery());
+        spds.setValidationQuery("anything");
+    }
+
+    @Test
+    public void testValidationQueryTimeout() {
+        assertEquals(-1, spds.getValidationQueryTimeout());
+        spds.setValidationQueryTimeout(10);
+        assertEquals(10, spds.getValidationQueryTimeout());
+    }
+
+    @Test
+    public void testRollbackAfterValidation() {
+        assertFalse(spds.isRollbackAfterValidation());
+        spds.setRollbackAfterValidation(true);
+        assertEquals(true, spds.isRollbackAfterValidation());
+    }
+
+    @Test(expected=IllegalStateException.class)
+    public void testRollbackAfterValidationWithConnectionCalled() throws SQLException {
+        spds.getConnection();
+        assertFalse(spds.isRollbackAfterValidation());
+        spds.setRollbackAfterValidation(true);
+        assertEquals(true, spds.isRollbackAfterValidation());
+    }
+
+    @Test
+    public void testMaxConnLifetimeMillis() {
+        assertEquals(-1, spds.getMaxConnLifetimeMillis());
+        spds.setMaxConnLifetimeMillis(10);
+        assertEquals(10, spds.getMaxConnLifetimeMillis());
+    }
+
+    @Test
+    public void testDefaultReadOnly() {
+        spds.setDefaultReadOnly(true);
+        assertTrue(spds.isDefaultReadOnly());
+        spds.setDefaultReadOnly(false);
+        assertFalse(spds.isDefaultReadOnly());
+    }
+
+    @Test
+    public void testDefaultTestOnCreate() {
+        spds.setDefaultTestOnCreate(false);
+        assertFalse(spds.getDefaultTestOnCreate());
+        spds.setDefaultTestOnCreate(true);
+        assertTrue(spds.getDefaultTestOnCreate());
+    }
+
+    @Test
+    public void testDefaultSoftMinEvictableIdleTimeMillis() {
+        spds.setDefaultSoftMinEvictableIdleTimeMillis(10);
+        assertEquals(10, spds.getDefaultSoftMinEvictableIdleTimeMillis());
+    }
+
+    @Test
+    public void testDefaultMinIdle() {
+        spds.setDefaultMinIdle(10);
+        assertEquals(10, spds.getDefaultMinIdle());
+    }
+
+    @Test
+    public void testDefaultLifo() {
+        spds.setDefaultLifo(true);
+        assertTrue(spds.getDefaultLifo());
+        spds.setDefaultLifo(false);
+        assertFalse(spds.getDefaultLifo());
+    }
+
+    @Test
+    public void testDefaultEvictionPolicyClassName() {
+        spds.setDefaultEvictionPolicyClassName(Object.class.getName());
+        assertEquals(Object.class.getName(), spds.getDefaultEvictionPolicyClassName());
+    }
+
+    @Test
+    public void testDefaultBlockWhenExhausted() {
+        spds.setDefaultBlockWhenExhausted(true);
+        assertTrue(spds.getDefaultBlockWhenExhausted());
+        spds.setDefaultBlockWhenExhausted(false);
+        assertFalse(spds.getDefaultBlockWhenExhausted());
+    }
+
+    @Test
+    public void testConnection() throws SQLException, ClassNotFoundException {
+        spds = new SharedPoolDataSource();
+        pcds.setDriver(DRIVER);
+        pcds.setUrl(URL);
+        spds.setConnectionPoolDataSource(pcds);
+        PooledConnectionAndInfo info = spds.getPooledConnectionAndInfo(null, null);
+        assertNull(info.getUsername());
+        assertNull(info.getPassword());
+        Connection conn = spds.getConnection();
+        assertNotNull(conn);
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java b/src/test/java/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java
index ad4debf..623ccb4 100644
--- a/src/test/java/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java
+++ b/src/test/java/org/apache/commons/dbcp2/datasources/TestPerUserPoolDataSource.java
@@ -31,12 +31,15 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.sql.DataSource;
 
 import org.apache.commons.dbcp2.TestConnectionPool;
 import org.apache.commons.dbcp2.TesterDriver;
 import org.apache.commons.dbcp2.cpdsadapter.DriverAdapterCPDS;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -44,19 +47,22 @@ import org.junit.Test;
  */
 public class TestPerUserPoolDataSource extends TestConnectionPool {
 
+    private String user;
+
     @Override
     protected Connection getConnection() throws SQLException {
-        return ds.getConnection("foo","bar");
+        return ds.getConnection(user,"bar");
     }
 
     private DataSource ds;
 
     @Before
     public void setUp() throws Exception {
+        user = "foo";
         final DriverAdapterCPDS pcds = new DriverAdapterCPDS();
         pcds.setDriver("org.apache.commons.dbcp2.TesterDriver");
         pcds.setUrl("jdbc:apache:commons:testdriver");
-        pcds.setUser("foo");
+        pcds.setUser(user);
         pcds.setPassword("bar");
         pcds.setAccessToUnderlyingConnectionAllowed(true);
 
@@ -64,14 +70,20 @@ public class TestPerUserPoolDataSource extends TestConnectionPool {
         tds.setConnectionPoolDataSource(pcds);
         tds.setDefaultMaxTotal(getMaxTotal());
         tds.setDefaultMaxWaitMillis((int)getMaxWaitMillis());
-        tds.setPerUserMaxTotal("foo", Integer.valueOf(getMaxTotal()));
-        tds.setPerUserMaxWaitMillis("foo", Long.valueOf(getMaxWaitMillis()));
+        tds.setPerUserMaxTotal(user, Integer.valueOf(getMaxTotal()));
+        tds.setPerUserMaxWaitMillis(user, Long.valueOf(getMaxWaitMillis()));
         tds.setDefaultTransactionIsolation(
             Connection.TRANSACTION_READ_COMMITTED);
         tds.setDefaultAutoCommit(Boolean.TRUE);
         ds = tds;
     }
 
+    @After
+    public void tearDown() throws Exception {
+        super.tearDown();
+        ((PerUserPoolDataSource) ds).close();
+    }
+
     /**
      * Switching 'u1 to 'u2' and 'p1' to 'p2' will
      * exhibit the bug detailed in
@@ -102,12 +114,12 @@ public class TestPerUserPoolDataSource extends TestConnectionPool {
         ds.getConnection("u1", "p1").close();
 
         // Try related users and passwords
-        ds.getConnection("foo", "bar").close();
+        ds.getConnection(user, "bar").close();
         try (Connection c = ds.getConnection("foob", "ar")) {
             fail("Should have caused an SQLException");
         } catch (final SQLException expected) {
         }
-        try (Connection c = ds.getConnection("foo", "baz")){
+        try (Connection c = ds.getConnection(user, "baz")){
             fail("Should have generated SQLException");
         } catch (final SQLException expected) {
         }
@@ -371,7 +383,7 @@ public class TestPerUserPoolDataSource extends TestConnectionPool {
         // some JVMs, e.g. Windows.
         final int defaultMaxWaitMillis = 430;
         ((PerUserPoolDataSource) ds).setDefaultMaxWaitMillis(defaultMaxWaitMillis);
-        ((PerUserPoolDataSource) ds).setPerUserMaxWaitMillis("foo",new Long(defaultMaxWaitMillis));
+        ((PerUserPoolDataSource) ds).setPerUserMaxWaitMillis(user,new Long(defaultMaxWaitMillis));
         multipleThreads(1, false, false, defaultMaxWaitMillis);
     }
 
@@ -379,7 +391,7 @@ public class TestPerUserPoolDataSource extends TestConnectionPool {
     public void testMultipleThreads2() throws Exception {
         final int defaultMaxWaitMillis = 500;
         ((PerUserPoolDataSource) ds).setDefaultMaxWaitMillis(defaultMaxWaitMillis);
-        ((PerUserPoolDataSource) ds).setPerUserMaxWaitMillis("foo",new Long(defaultMaxWaitMillis));
+        ((PerUserPoolDataSource) ds).setPerUserMaxWaitMillis(user,new Long(defaultMaxWaitMillis));
         multipleThreads(2 * defaultMaxWaitMillis, true, true, defaultMaxWaitMillis);
     }
 
@@ -501,37 +513,1128 @@ public class TestPerUserPoolDataSource extends TestConnectionPool {
     // See DBCP-8
     @Test
     public void testChangePassword() throws Exception {
-        try (Connection c = ds.getConnection("foo", "bay")){
+        try (Connection c = ds.getConnection(user, "bay")){
             fail("Should have generated SQLException");
         } catch (final SQLException expected) {
         }
-        final Connection con1 = ds.getConnection("foo", "bar");
-        final Connection con2 = ds.getConnection("foo", "bar");
-        final Connection con3 = ds.getConnection("foo", "bar");
+        final Connection con1 = ds.getConnection(user, "bar");
+        final Connection con2 = ds.getConnection(user, "bar");
+        final Connection con3 = ds.getConnection(user, "bar");
         con1.close();
         con2.close();
-        TesterDriver.addUser("foo","bay"); // change the user/password setting
+        TesterDriver.addUser(user,"bay"); // change the user/password setting
         try {
-            final Connection con4 = ds.getConnection("foo", "bay"); // new password
+            final Connection con4 = ds.getConnection(user, "bay"); // new password
             // Idle instances with old password should have been cleared
             assertEquals("Should be no idle connections in the pool",
-                    0, ((PerUserPoolDataSource) ds).getNumIdle("foo"));
+                    0, ((PerUserPoolDataSource) ds).getNumIdle(user));
             con4.close();
             // Should be one idle instance with new pwd
             assertEquals("Should be one idle connection in the pool",
-                    1, ((PerUserPoolDataSource) ds).getNumIdle("foo"));
-            try (Connection c = ds.getConnection("foo", "bar")) { // old password
+                    1, ((PerUserPoolDataSource) ds).getNumIdle(user));
+            try (Connection c = ds.getConnection(user, "bar")) { // old password
                 fail("Should have generated SQLException");
             } catch (final SQLException expected) {
             }
-            final Connection con5 = ds.getConnection("foo", "bay"); // take the idle one
+            final Connection con5 = ds.getConnection(user, "bay"); // take the idle one
             con3.close(); // Return a connection with the old password
-            ds.getConnection("foo", "bay").close();  // will try bad returned connection and destroy it
+            ds.getConnection(user, "bay").close();  // will try bad returned connection and destroy it
             assertEquals("Should be one idle connection in the pool",
-                    1, ((PerUserPoolDataSource) ds).getNumIdle("foo"));
+                    1, ((PerUserPoolDataSource) ds).getNumIdle(user));
             con5.close();
         } finally {
-            TesterDriver.addUser("foo","bar");
+            TesterDriver.addUser(user,"bar");
         }
     }
+
+    // getters and setters. Most follow the same pattern. The initial tests contain a more
+    // complete documentation, which can be helpful when write/understanding the other methods.
+
+    // -- per user block when exhausted
+
+    /**
+     * Test per user block when exhausted, with the backing map not initialized before.
+     * Instead we pass the map.
+     */
+    @Test
+    public void testPerUserBlockWhenExhaustedMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> userDefaultBlockWhenExhausted = new HashMap<>();
+        userDefaultBlockWhenExhausted.put("key", Boolean.TRUE);
+        ds.setPerUserBlockWhenExhausted(userDefaultBlockWhenExhausted);
+        assertEquals(Boolean.TRUE, ds.getPerUserBlockWhenExhausted("key"));
+    }
+
+    /**
+     * Test per user block when exhausted, with the backing map initialized before.
+     */
+    @Test
+    public void testPerUserBlockWhenExhaustedMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> userDefaultBlockWhenExhausted = new HashMap<>();
+        userDefaultBlockWhenExhausted.put("key", Boolean.FALSE);
+        ds.setPerUserBlockWhenExhausted(userDefaultBlockWhenExhausted);
+        assertEquals(Boolean.FALSE, ds.getPerUserBlockWhenExhausted("key"));
+        // when the code above is executed, the backing map was initalized
+        // now check if that still works. The backing map is clear'ed.
+        userDefaultBlockWhenExhausted = new HashMap<>();
+        userDefaultBlockWhenExhausted.put("anonymous", Boolean.FALSE);
+        ds.setPerUserBlockWhenExhausted(userDefaultBlockWhenExhausted);
+        // now the previously entered value was cleared, so it will be back to the
+        // default value of TRUE
+        assertEquals(Boolean.TRUE, ds.getPerUserBlockWhenExhausted("key"));
+        // and our new value exists too
+        assertEquals(Boolean.FALSE, ds.getPerUserBlockWhenExhausted("anonymous"));
+    }
+
+    /**
+     * Test per user block when exhausted, with the backing map not initialized before.
+     * Instead, we pass the map. And furthermore, we are now searching for an inexistent
+     * key, which should return the default value.
+     */
+    @Test
+    public void testPerUserBlockWhenExhaustedMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> userDefaultBlockWhenExhausted = new HashMap<>();
+        userDefaultBlockWhenExhausted.put("key", Boolean.FALSE);
+        ds.setPerUserBlockWhenExhausted(userDefaultBlockWhenExhausted);
+        assertEquals(ds.getDefaultBlockWhenExhausted(), ds.getPerUserBlockWhenExhausted("missingkey"));
+    }
+
+    /**
+     * Test per user block when exhausted, with the backing map not initialized before.
+     * Instead we pass the user and value, and hence the map is initialized beforehand.
+     */
+    @Test
+    public void testPerUserBlockWhenExhaustedWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserBlockWhenExhausted(user, Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserBlockWhenExhausted(user));
+    }
+
+    /**
+     * Test per user block when exhausted, with the backing map not initialized before.
+     * Instead we pass the user and value, and hence the map is initialized beforehand.
+     * After that, we pass another user, so both values should still be present. The
+     * PerUserPoolDataSource does not clear the perUserPoolDataSource map, unless you
+     * pass a new map, using another internal/package method.
+     */
+    @Test
+    public void testPerUserBlockWhenExhaustedWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserBlockWhenExhausted(user, Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserBlockWhenExhausted(user));
+        // when the code above is executed, the backing map was initalized
+        // now check if that still works. The backing map is NOT clear'ed.
+        ds.setPerUserBlockWhenExhausted("anotheruser", Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserBlockWhenExhausted(user));
+        assertEquals(Boolean.FALSE, ds.getPerUserBlockWhenExhausted("anotheruser"));
+    }
+
+    /**
+     * Test per user block when exhausted, with the backing map not initialized before.
+     * Instead we pass the user and value, and hence the map is initialized beforehand.
+     * Furthermore, we are now searching for an inexistent key, which should return the
+     * default value.
+     */
+    @Test
+    public void testPerUserBlockWhenExhaustedWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserBlockWhenExhausted("whatismyuseragain?", Boolean.FALSE);
+        assertEquals(Boolean.TRUE, ds.getPerUserBlockWhenExhausted("missingkey"));
+    }
+
+    // -- per user default auto commit
+
+    @Test
+    public void testPerUserDefaultAutoCommitMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.TRUE);
+        ds.setPerUserDefaultAutoCommit(values);
+        assertEquals(Boolean.TRUE, ds.getPerUserDefaultAutoCommit("key"));
+    }
+
+    @Test
+    public void testPerUserDefaultAutoCommitMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.FALSE);
+        ds.setPerUserDefaultAutoCommit(values);
+        assertEquals(Boolean.FALSE, ds.getPerUserDefaultAutoCommit("key"));
+        values = new HashMap<>();
+        values.put("anonymous", Boolean.FALSE);
+        ds.setPerUserDefaultAutoCommit(values);
+        assertEquals(null, ds.getPerUserDefaultAutoCommit("key"));
+        assertEquals(Boolean.FALSE, ds.getPerUserDefaultAutoCommit("anonymous"));
+    }
+
+    @Test
+    public void testPerUserDefaultAutoCommitMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.FALSE);
+        ds.setPerUserDefaultAutoCommit(values);
+        // TODO this is not consistent with the other methods
+        assertEquals(null, ds.getPerUserDefaultAutoCommit("missingkey"));
+    }
+
+    @Test
+    public void testPerUserDefaultAutoCommitWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserDefaultAutoCommit(user, Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserDefaultAutoCommit(user));
+    }
+
+    @Test
+    public void testPerUserDefaultAutoCommitWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserDefaultAutoCommit(user, Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserDefaultAutoCommit(user));
+        ds.setPerUserDefaultAutoCommit("anotheruser", Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserDefaultAutoCommit(user));
+        assertEquals(Boolean.FALSE, ds.getPerUserDefaultAutoCommit("anotheruser"));
+    }
+
+    @Test
+    public void testPerUserDefaultAutoCommitWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserDefaultAutoCommit("whatismyuseragain?", Boolean.FALSE);
+        // TODO this is not consistent with the other methods
+        assertEquals(null, ds.getPerUserDefaultAutoCommit("missingkey"));
+    }
+
+    // -- per user default read only
+
+    @Test
+    public void testPerUserDefaultReadOnlyMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.TRUE);
+        ds.setPerUserDefaultReadOnly(values);
+        assertEquals(Boolean.TRUE, ds.getPerUserDefaultReadOnly("key"));
+    }
+
+    @Test
+    public void testPerUserDefaultReadOnlyMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.FALSE);
+        ds.setPerUserDefaultReadOnly(values);
+        assertEquals(Boolean.FALSE, ds.getPerUserDefaultReadOnly("key"));
+        values = new HashMap<>();
+        values.put("anonymous", Boolean.FALSE);
+        ds.setPerUserDefaultReadOnly(values);
+        assertEquals(null, ds.getPerUserDefaultReadOnly("key"));
+        assertEquals(Boolean.FALSE, ds.getPerUserDefaultReadOnly("anonymous"));
+    }
+
+    @Test
+    public void testPerUserDefaultReadOnlyMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.FALSE);
+        ds.setPerUserDefaultReadOnly(values);
+        // TODO this is not consistent with the other methods
+        assertEquals(null, ds.getPerUserDefaultReadOnly("missingkey"));
+    }
+
+    @Test
+    public void testPerUserDefaultReadOnlyWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserDefaultReadOnly(user, Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserDefaultReadOnly(user));
+    }
+
+    @Test
+    public void testPerUserDefaultReadOnlyWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserDefaultReadOnly(user, Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserDefaultReadOnly(user));
+        ds.setPerUserDefaultReadOnly("anotheruser", Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserDefaultReadOnly(user));
+        assertEquals(Boolean.FALSE, ds.getPerUserDefaultReadOnly("anotheruser"));
+    }
+
+    @Test
+    public void testPerUserDefaultReadOnlyWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserDefaultReadOnly("whatismyuseragain?", Boolean.FALSE);
+        // TODO this is not consistent with the other methods
+        assertEquals(null, ds.getPerUserDefaultReadOnly("missingkey"));
+    }
+
+    // -- per user default transaction isolation
+
+    @Test
+    public void testPerUserDefaultTransactionIsolationMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Integer> values = new HashMap<>();
+        values.put("key", 1);
+        ds.setPerUserDefaultTransactionIsolation(values);
+        assertEquals((Integer) 1, (Integer) ds.getPerUserDefaultTransactionIsolation("key"));
+    }
+
+    @Test
+    public void testPerUserDefaultTransactionIsolationMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Integer> values = new HashMap<>();
+        values.put("key", 0);
+        ds.setPerUserDefaultTransactionIsolation(values);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserDefaultTransactionIsolation("key"));
+        values = new HashMap<>();
+        values.put("anonymous", 0);
+        ds.setPerUserDefaultTransactionIsolation(values);
+        // TODO this is not consistent with the other methods
+        assertEquals(null, (Integer) ds.getPerUserDefaultTransactionIsolation("key"));
+        assertEquals((Integer) 0, (Integer) ds.getPerUserDefaultTransactionIsolation("anonymous"));
+    }
+
+    @Test
+    public void testPerUserDefaultTransactionIsolationMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Integer> values = new HashMap<>();
+        values.put("key", 0);
+        ds.setPerUserDefaultTransactionIsolation(values);
+        // TODO this is not consistent with the other methods
+        assertEquals(null, (Integer) ds.getPerUserDefaultTransactionIsolation("missingkey"));
+    }
+
+    @Test
+    public void testPerUserDefaultTransactionIsolationWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserDefaultTransactionIsolation(user, 0);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserDefaultTransactionIsolation(user));
+    }
+
+    @Test
+    public void testPerUserDefaultTransactionIsolationWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserDefaultTransactionIsolation(user, 0);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserDefaultTransactionIsolation(user));
+        ds.setPerUserDefaultTransactionIsolation("anotheruser", 0);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserDefaultTransactionIsolation(user));
+        assertEquals((Integer) 0, (Integer) ds.getPerUserDefaultTransactionIsolation("anotheruser"));
+    }
+
+    @Test
+    public void testPerUserDefaultTransactionIsolationWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserDefaultTransactionIsolation("whatismyuseragain?", 0);
+        // TODO this is not consistent with the other methods
+        assertEquals(null, (Integer) ds.getPerUserDefaultTransactionIsolation("missingkey"));
+    }
+
+    // -- per user eviction policy class name
+
+    @Test
+    public void testPerUserEvictionPolicyClassNameMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, String> values = new HashMap<>();
+        values.put("key", "test");
+        ds.setPerUserEvictionPolicyClassName(values);
+        assertEquals("test", ds.getPerUserEvictionPolicyClassName("key"));
+    }
+
+    @Test
+    public void testPerUserEvictionPolicyClassNameMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, String> values = new HashMap<>();
+        values.put("key", "bar");
+        ds.setPerUserEvictionPolicyClassName(values);
+        assertEquals("bar", ds.getPerUserEvictionPolicyClassName("key"));
+        values = new HashMap<>();
+        values.put("anonymous", "bar");
+        ds.setPerUserEvictionPolicyClassName(values);
+        assertEquals(ds.getDefaultEvictionPolicyClassName(), ds.getPerUserEvictionPolicyClassName("key"));
+        assertEquals("bar", ds.getPerUserEvictionPolicyClassName("anonymous"));
+    }
+
+    @Test
+    public void testPerUserEvictionPolicyClassNameMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, String> values = new HashMap<>();
+        values.put("key", "bar");
+        ds.setPerUserEvictionPolicyClassName(values);
+        assertEquals(ds.getDefaultEvictionPolicyClassName(), ds.getPerUserEvictionPolicyClassName("missingkey"));
+    }
+
+    @Test
+    public void testPerUserEvictionPolicyClassNameWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserEvictionPolicyClassName(user, "bar");
+        assertEquals("bar", ds.getPerUserEvictionPolicyClassName(user));
+    }
+
+    @Test
+    public void testPerUserEvictionPolicyClassNameWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserEvictionPolicyClassName(user, "bar");
+        assertEquals("bar", ds.getPerUserEvictionPolicyClassName(user));
+        ds.setPerUserEvictionPolicyClassName("anotheruser", "bar");
+        assertEquals("bar", ds.getPerUserEvictionPolicyClassName(user));
+        assertEquals("bar", ds.getPerUserEvictionPolicyClassName("anotheruser"));
+    }
+
+    @Test
+    public void testPerUserEvictionPolicyClassNameWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserEvictionPolicyClassName("whatismyuseragain?", "bar");
+        assertEquals(ds.getDefaultEvictionPolicyClassName(), ds.getPerUserEvictionPolicyClassName("missingkey"));
+    }
+
+    // -- per user lifo
+
+    @Test
+    public void testPerUserLifoMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.TRUE);
+        ds.setPerUserLifo(values);
+        assertEquals(Boolean.TRUE, ds.getPerUserLifo("key"));
+    }
+
+    @Test
+    public void testPerUserLifoMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.FALSE);
+        ds.setPerUserLifo(values);
+        assertEquals(Boolean.FALSE, ds.getPerUserLifo("key"));
+        values = new HashMap<>();
+        values.put("anonymous", Boolean.FALSE);
+        ds.setPerUserLifo(values);
+        assertEquals(ds.getDefaultLifo(), ds.getPerUserLifo("key"));
+        assertEquals(Boolean.FALSE, ds.getPerUserLifo("anonymous"));
+    }
+
+    @Test
+    public void testPerUserLifoMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.FALSE);
+        ds.setPerUserLifo(values);
+        assertEquals(ds.getDefaultLifo(), ds.getPerUserLifo("missingkey"));
+    }
+
+    @Test
+    public void testPerUserLifoWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserLifo(user, Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserLifo(user));
+    }
+
+    @Test
+    public void testPerUserLifoWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserLifo(user, Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserLifo(user));
+        ds.setPerUserLifo("anotheruser", Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserLifo(user));
+        assertEquals(Boolean.FALSE, ds.getPerUserLifo("anotheruser"));
+    }
+
+    @Test
+    public void testPerUserLifoWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserLifo("whatismyuseragain?", Boolean.FALSE);
+        assertEquals(ds.getDefaultLifo(), ds.getPerUserLifo("missingkey"));
+    }
+
+    // -- per user max idle
+
+    @Test
+    public void testPerUserMaxIdleMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Integer> values = new HashMap<>();
+        values.put("key", 1);
+        ds.setPerUserMaxIdle(values);
+        assertEquals((Integer) 1, (Integer) ds.getPerUserMaxIdle("key"));
+    }
+
+    @Test
+    public void testPerUserMaxIdleMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Integer> values = new HashMap<>();
+        values.put("key", 0);
+        ds.setPerUserMaxIdle(values);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMaxIdle("key"));
+        values = new HashMap<>();
+        values.put("anonymous", 0);
+        ds.setPerUserMaxIdle(values);
+        assertEquals((Integer) ds.getDefaultMaxIdle(), (Integer) ds.getPerUserMaxIdle("key"));
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMaxIdle("anonymous"));
+    }
+
+    @Test
+    public void testPerUserMaxIdleMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Integer> values = new HashMap<>();
+        values.put("key", 0);
+        ds.setPerUserMaxIdle(values);
+        assertEquals((Integer) ds.getDefaultMaxIdle(), (Integer) ds.getPerUserMaxIdle("missingkey"));
+    }
+
+    @Test
+    public void testPerUserMaxIdleWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserMaxIdle(user, 0);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMaxIdle(user));
+    }
+
+    @Test
+    public void testPerUserMaxIdleWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserMaxIdle(user, 0);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMaxIdle(user));
+        ds.setPerUserMaxIdle("anotheruser", 0);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMaxIdle(user));
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMaxIdle("anotheruser"));
+    }
+
+    @Test
+    public void testPerUserMaxIdleWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserMaxIdle("whatismyuseragain?", 0);
+        assertEquals((Integer) ds.getDefaultMaxIdle(), (Integer) ds.getPerUserMaxIdle("missingkey"));
+    }
+
+    // -- per user max total
+
+    @Test
+    public void testPerUserMaxTotalMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Integer> values = new HashMap<>();
+        values.put("key", 1);
+        ds.setPerUserMaxTotal(values);
+        assertEquals((Integer) 1, (Integer) ds.getPerUserMaxTotal("key"));
+    }
+
+    @Test
+    public void testPerUserMaxTotalMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Integer> values = new HashMap<>();
+        values.put("key", 0);
+        ds.setPerUserMaxTotal(values);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMaxTotal("key"));
+        values = new HashMap<>();
+        values.put("anonymous", 0);
+        ds.setPerUserMaxTotal(values);
+        assertEquals((Integer) ds.getDefaultMaxTotal(), (Integer) ds.getPerUserMaxTotal("key"));
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMaxTotal("anonymous"));
+    }
+
+    @Test
+    public void testPerUserMaxTotalMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Integer> values = new HashMap<>();
+        values.put("key", 0);
+        ds.setPerUserMaxTotal(values);
+        assertEquals((Integer) ds.getDefaultMaxTotal(), (Integer) ds.getPerUserMaxTotal("missingkey"));
+    }
+
+    @Test
+    public void testPerUserMaxTotalWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserMaxTotal(user, 0);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMaxTotal(user));
+    }
+
+    @Test
+    public void testPerUserMaxTotalWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserMaxTotal(user, 0);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMaxTotal(user));
+        ds.setPerUserMaxTotal("anotheruser", 0);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMaxTotal(user));
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMaxTotal("anotheruser"));
+    }
+
+    @Test
+    public void testPerUserMaxTotalWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserMaxTotal("whatismyuseragain?", 0);
+        assertEquals((Integer) ds.getDefaultMaxTotal(), (Integer) ds.getPerUserMaxTotal("missingkey"));
+    }
+
+    // -- per user max wait millis
+
+    @Test
+    public void testPerUserMaxWaitMillisMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Long> values = new HashMap<>();
+        values.put("key", 1l);
+        ds.setPerUserMaxWaitMillis(values);
+        assertEquals(1l, ds.getPerUserMaxWaitMillis("key"));
+    }
+
+    @Test
+    public void testPerUserMaxWaitMillisMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Long> values = new HashMap<>();
+        values.put("key", 0l);
+        ds.setPerUserMaxWaitMillis(values);
+        assertEquals(0l, ds.getPerUserMaxWaitMillis("key"));
+        values = new HashMap<>();
+        values.put("anonymous", 0l);
+        ds.setPerUserMaxWaitMillis(values);
+        assertEquals(ds.getDefaultMaxWaitMillis(), ds.getPerUserMaxWaitMillis("key"));
+        assertEquals(0l, ds.getPerUserMaxWaitMillis("anonymous"));
+    }
+
+    @Test
+    public void testPerUserMaxWaitMillisMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Long> values = new HashMap<>();
+        values.put("key", 0l);
+        ds.setPerUserMaxWaitMillis(values);
+        assertEquals(ds.getDefaultMaxWaitMillis(), ds.getPerUserMaxWaitMillis("missingkey"));
+    }
+
+    @Test
+    public void testPerUserMaxWaitMillisWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserMaxWaitMillis(user, 0l);
+        assertEquals(0l, ds.getPerUserMaxWaitMillis(user));
+    }
+
+    @Test
+    public void testPerUserMaxWaitMillisWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserMaxWaitMillis(user, 0l);
+        assertEquals(0l, ds.getPerUserMaxWaitMillis(user));
+        ds.setPerUserMaxWaitMillis("anotheruser", 0l);
+        assertEquals(0l, ds.getPerUserMaxWaitMillis(user));
+        assertEquals(0l, ds.getPerUserMaxWaitMillis("anotheruser"));
+    }
+
+    @Test
+    public void testPerUserMaxWaitMillisWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserMaxWaitMillis("whatismyuseragain?", 0l);
+        assertEquals(ds.getDefaultMaxWaitMillis(), ds.getPerUserMaxWaitMillis("missingkey"));
+    }
+
+    // -- per user min evictable idle time millis
+
+    @Test
+    public void testPerUserMinEvictableIdleTimeMillisMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Long> values = new HashMap<>();
+        values.put("key", 1l);
+        ds.setPerUserMinEvictableIdleTimeMillis(values);
+        assertEquals(1l, ds.getPerUserMinEvictableIdleTimeMillis("key"));
+    }
+
+    @Test
+    public void testPerUserMinEvictableIdleTimeMillisMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Long> values = new HashMap<>();
+        values.put("key", 0l);
+        ds.setPerUserMinEvictableIdleTimeMillis(values);
+        assertEquals(0l, ds.getPerUserMinEvictableIdleTimeMillis("key"));
+        values = new HashMap<>();
+        values.put("anonymous", 0l);
+        ds.setPerUserMinEvictableIdleTimeMillis(values);
+        assertEquals(ds.getDefaultMinEvictableIdleTimeMillis(), ds.getPerUserMinEvictableIdleTimeMillis("key"));
+        assertEquals(0l, ds.getPerUserMinEvictableIdleTimeMillis("anonymous"));
+    }
+
+    @Test
+    public void testPerUserMinEvictableIdleTimeMillisMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Long> values = new HashMap<>();
+        values.put("key", 0l);
+        ds.setPerUserMinEvictableIdleTimeMillis(values);
+        assertEquals(ds.getDefaultMinEvictableIdleTimeMillis(), ds.getPerUserMinEvictableIdleTimeMillis("missingkey"));
+    }
+
+    @Test
+    public void testPerUserMinEvictableIdleTimeMillisWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserMinEvictableIdleTimeMillis(user, 0l);
+        assertEquals(0l, ds.getPerUserMinEvictableIdleTimeMillis(user));
+    }
+
+    @Test
+    public void testPerUserMinEvictableIdleTimeMillisWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserMinEvictableIdleTimeMillis(user, 0l);
+        assertEquals(0l, ds.getPerUserMinEvictableIdleTimeMillis(user));
+        ds.setPerUserMinEvictableIdleTimeMillis("anotheruser", 0l);
+        assertEquals(0l, ds.getPerUserMinEvictableIdleTimeMillis(user));
+        assertEquals(0l, ds.getPerUserMinEvictableIdleTimeMillis("anotheruser"));
+    }
+
+    @Test
+    public void testPerUserMinEvictableIdleTimeMillisWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserMinEvictableIdleTimeMillis("whatismyuseragain?", 0l);
+        assertEquals(ds.getDefaultMinEvictableIdleTimeMillis(), ds.getPerUserMinEvictableIdleTimeMillis("missingkey"));
+    }
+
+    // -- per user min idle
+
+    @Test
+    public void testPerUserMinIdleMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Integer> values = new HashMap<>();
+        values.put("key", 1);
+        ds.setPerUserMinIdle(values);
+        assertEquals((Integer) 1, (Integer) ds.getPerUserMinIdle("key"));
+    }
+
+    @Test
+    public void testPerUserMinIdleMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Integer> values = new HashMap<>();
+        values.put("key", 0);
+        ds.setPerUserMinIdle(values);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMinIdle("key"));
+        values = new HashMap<>();
+        values.put("anonymous", 0);
+        ds.setPerUserMinIdle(values);
+        assertEquals((Integer) ds.getDefaultMinIdle(), (Integer) ds.getPerUserMinIdle("key"));
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMinIdle("anonymous"));
+    }
+
+    @Test
+    public void testPerUserMinIdleMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Integer> values = new HashMap<>();
+        values.put("key", 0);
+        ds.setPerUserMinIdle(values);
+        assertEquals((Integer) ds.getDefaultMinIdle(), (Integer) ds.getPerUserMinIdle("missingkey"));
+    }
+
+    @Test
+    public void testPerUserMinIdleWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserMinIdle(user, 0);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMinIdle(user));
+    }
+
+    @Test
+    public void testPerUserMinIdleWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserMinIdle(user, 0);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMinIdle(user));
+        ds.setPerUserMinIdle("anotheruser", 0);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMinIdle(user));
+        assertEquals((Integer) 0, (Integer) ds.getPerUserMinIdle("anotheruser"));
+    }
+
+    @Test
+    public void testPerUserMinIdleWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserMinIdle("whatismyuseragain?", 0);
+        assertEquals((Integer) ds.getDefaultMinIdle(), (Integer) ds.getPerUserMinIdle("missingkey"));
+    }
+
+    // -- per user num tests per eviction run
+
+    @Test
+    public void testPerUserNumTestsPerEvictionRunMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Integer> values = new HashMap<>();
+        values.put("key", 1);
+        ds.setPerUserNumTestsPerEvictionRun(values);
+        assertEquals((Integer) 1, (Integer) ds.getPerUserNumTestsPerEvictionRun("key"));
+    }
+
+    @Test
+    public void testPerUserNumTestsPerEvictionRunMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Integer> values = new HashMap<>();
+        values.put("key", 0);
+        ds.setPerUserNumTestsPerEvictionRun(values);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserNumTestsPerEvictionRun("key"));
+        values = new HashMap<>();
+        values.put("anonymous", 0);
+        ds.setPerUserNumTestsPerEvictionRun(values);
+        assertEquals((Integer) ds.getDefaultNumTestsPerEvictionRun(), (Integer) ds.getPerUserNumTestsPerEvictionRun("key"));
+        assertEquals((Integer) 0, (Integer) ds.getPerUserNumTestsPerEvictionRun("anonymous"));
+    }
+
+    @Test
+    public void testPerUserNumTestsPerEvictionRunMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Integer> values = new HashMap<>();
+        values.put("key", 0);
+        ds.setPerUserNumTestsPerEvictionRun(values);
+        assertEquals((Integer) ds.getDefaultNumTestsPerEvictionRun(), (Integer) ds.getPerUserNumTestsPerEvictionRun("missingkey"));
+    }
+
+    @Test
+    public void testPerUserNumTestsPerEvictionRunWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserNumTestsPerEvictionRun(user, 0);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserNumTestsPerEvictionRun(user));
+    }
+
+    @Test
+    public void testPerUserNumTestsPerEvictionRunWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserNumTestsPerEvictionRun(user, 0);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserNumTestsPerEvictionRun(user));
+        ds.setPerUserNumTestsPerEvictionRun("anotheruser", 0);
+        assertEquals((Integer) 0, (Integer) ds.getPerUserNumTestsPerEvictionRun(user));
+        assertEquals((Integer) 0, (Integer) ds.getPerUserNumTestsPerEvictionRun("anotheruser"));
+    }
+
+    @Test
+    public void testPerUserNumTestsPerEvictionRunWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserNumTestsPerEvictionRun("whatismyuseragain?", 0);
+        assertEquals((Integer) ds.getDefaultNumTestsPerEvictionRun(), (Integer) ds.getPerUserNumTestsPerEvictionRun("missingkey"));
+    }
+
+    // -- per user soft min evictable idle time millis
+
+    @Test
+    public void testPerUserSoftMinEvictableIdleTimeMillisMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Long> values = new HashMap<>();
+        values.put("key", 1l);
+        ds.setPerUserSoftMinEvictableIdleTimeMillis(values);
+        assertEquals(1l, ds.getPerUserSoftMinEvictableIdleTimeMillis("key"));
+    }
+
+    @Test
+    public void testPerUserSoftMinEvictableIdleTimeMillisMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Long> values = new HashMap<>();
+        values.put("key", 0l);
+        ds.setPerUserSoftMinEvictableIdleTimeMillis(values);
+        assertEquals(0l, ds.getPerUserSoftMinEvictableIdleTimeMillis("key"));
+        values = new HashMap<>();
+        values.put("anonymous", 0l);
+        ds.setPerUserSoftMinEvictableIdleTimeMillis(values);
+        assertEquals(ds.getDefaultSoftMinEvictableIdleTimeMillis(), ds.getPerUserSoftMinEvictableIdleTimeMillis("key"));
+        assertEquals(0l, ds.getPerUserSoftMinEvictableIdleTimeMillis("anonymous"));
+    }
+
+    @Test
+    public void testPerUserSoftMinEvictableIdleTimeMillisMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Long> values = new HashMap<>();
+        values.put("key", 0l);
+        ds.setPerUserSoftMinEvictableIdleTimeMillis(values);
+        assertEquals(ds.getDefaultSoftMinEvictableIdleTimeMillis(), ds.getPerUserSoftMinEvictableIdleTimeMillis("missingkey"));
+    }
+
+    @Test
+    public void testPerUserSoftMinEvictableIdleTimeMillisWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserSoftMinEvictableIdleTimeMillis(user, 0l);
+        assertEquals(0l, ds.getPerUserSoftMinEvictableIdleTimeMillis(user));
+    }
+
+    @Test
+    public void testPerUserSoftMinEvictableIdleTimeMillisWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserSoftMinEvictableIdleTimeMillis(user, 0l);
+        assertEquals(0l, ds.getPerUserSoftMinEvictableIdleTimeMillis(user));
+        ds.setPerUserSoftMinEvictableIdleTimeMillis("anotheruser", 0l);
+        assertEquals(0l, ds.getPerUserSoftMinEvictableIdleTimeMillis(user));
+        assertEquals(0l, ds.getPerUserSoftMinEvictableIdleTimeMillis("anotheruser"));
+    }
+
+    @Test
+    public void testPerUserSoftMinEvictableIdleTimeMillisWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserSoftMinEvictableIdleTimeMillis("whatismyuseragain?", 0l);
+        assertEquals(ds.getDefaultSoftMinEvictableIdleTimeMillis(), ds.getPerUserSoftMinEvictableIdleTimeMillis("missingkey"));
+    }
+
+    // -- per user test on borrow
+
+    @Test
+    public void testPerUserTestOnBorrowMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.TRUE);
+        ds.setPerUserTestOnBorrow(values);
+        assertEquals(Boolean.TRUE, ds.getPerUserTestOnBorrow("key"));
+    }
+
+    @Test
+    public void testPerUserTestOnBorrowMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.FALSE);
+        ds.setPerUserTestOnBorrow(values);
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnBorrow("key"));
+        values = new HashMap<>();
+        values.put("anonymous", Boolean.FALSE);
+        ds.setPerUserTestOnBorrow(values);
+        assertEquals(ds.getDefaultTestOnBorrow(), ds.getPerUserTestOnBorrow("key"));
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnBorrow("anonymous"));
+    }
+
+    @Test
+    public void testPerUserTestOnBorrowMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.FALSE);
+        ds.setPerUserTestOnBorrow(values);
+        assertEquals(ds.getDefaultTestOnBorrow(), ds.getPerUserTestOnBorrow("missingkey"));
+    }
+
+    @Test
+    public void testPerUserTestOnBorrowWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserTestOnBorrow(user, Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnBorrow(user));
+    }
+
+    @Test
+    public void testPerUserTestOnBorrowWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserTestOnBorrow(user, Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnBorrow(user));
+        ds.setPerUserTestOnBorrow("anotheruser", Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnBorrow(user));
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnBorrow("anotheruser"));
+    }
+
+    @Test
+    public void testPerUserTestOnBorrowWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserTestOnBorrow("whatismyuseragain?", Boolean.FALSE);
+        assertEquals(ds.getDefaultTestOnBorrow(), ds.getPerUserTestOnBorrow("missingkey"));
+    }
+
+    // -- per user test on create
+
+    @Test
+    public void testPerUserTestOnCreateMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.TRUE);
+        ds.setPerUserTestOnCreate(values);
+        assertEquals(Boolean.TRUE, ds.getPerUserTestOnCreate("key"));
+    }
+
+    @Test
+    public void testPerUserTestOnCreateMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.FALSE);
+        ds.setPerUserTestOnCreate(values);
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnCreate("key"));
+        values = new HashMap<>();
+        values.put("anonymous", Boolean.FALSE);
+        ds.setPerUserTestOnCreate(values);
+        assertEquals(ds.getDefaultTestOnCreate(), ds.getPerUserTestOnCreate("key"));
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnCreate("anonymous"));
+    }
+
+    @Test
+    public void testPerUserTestOnCreateMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.FALSE);
+        ds.setPerUserTestOnCreate(values);
+        assertEquals(ds.getDefaultTestOnCreate(), ds.getPerUserTestOnCreate("missingkey"));
+    }
+
+    @Test
+    public void testPerUserTestOnCreateWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserTestOnCreate(user, Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnCreate(user));
+    }
+
+    @Test
+    public void testPerUserTestOnCreateWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserTestOnCreate(user, Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnCreate(user));
+        ds.setPerUserTestOnCreate("anotheruser", Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnCreate(user));
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnCreate("anotheruser"));
+    }
+
+    @Test
+    public void testPerUserTestOnCreateWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserTestOnCreate("whatismyuseragain?", Boolean.FALSE);
+        assertEquals(ds.getDefaultTestOnCreate(), ds.getPerUserTestOnCreate("missingkey"));
+    }
+
+    // -- per user test on return
+
+    @Test
+    public void testPerUserTestOnReturnMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.TRUE);
+        ds.setPerUserTestOnReturn(values);
+        assertEquals(Boolean.TRUE, ds.getPerUserTestOnReturn("key"));
+    }
+
+    @Test
+    public void testPerUserTestOnReturnMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.FALSE);
+        ds.setPerUserTestOnReturn(values);
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnReturn("key"));
+        values = new HashMap<>();
+        values.put("anonymous", Boolean.FALSE);
+        ds.setPerUserTestOnReturn(values);
+        assertEquals(ds.getDefaultTestOnReturn(), ds.getPerUserTestOnReturn("key"));
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnReturn("anonymous"));
+    }
+
+    @Test
+    public void testPerUserTestOnReturnMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.FALSE);
+        ds.setPerUserTestOnReturn(values);
+        assertEquals(ds.getDefaultTestOnReturn(), ds.getPerUserTestOnReturn("missingkey"));
+    }
+
+    @Test
+    public void testPerUserTestOnReturnWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserTestOnReturn(user, Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnReturn(user));
+    }
+
+    @Test
+    public void testPerUserTestOnReturnWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserTestOnReturn(user, Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnReturn(user));
+        ds.setPerUserTestOnReturn("anotheruser", Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnReturn(user));
+        assertEquals(Boolean.FALSE, ds.getPerUserTestOnReturn("anotheruser"));
+    }
+
+    @Test
+    public void testPerUserTestOnReturnWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserTestOnReturn("whatismyuseragain?", Boolean.FALSE);
+        assertEquals(ds.getDefaultTestOnReturn(), ds.getPerUserTestOnReturn("missingkey"));
+    }
+
+    // -- per user test while idle
+
+    @Test
+    public void testPerUserTestWhileIdleMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.TRUE);
+        ds.setPerUserTestWhileIdle(values);
+        assertEquals(Boolean.TRUE, ds.getPerUserTestWhileIdle("key"));
+    }
+
+    @Test
+    public void testPerUserTestWhileIdleMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.FALSE);
+        ds.setPerUserTestWhileIdle(values);
+        assertEquals(Boolean.FALSE, ds.getPerUserTestWhileIdle("key"));
+        values = new HashMap<>();
+        values.put("anonymous", Boolean.FALSE);
+        ds.setPerUserTestWhileIdle(values);
+        assertEquals(ds.getDefaultTestWhileIdle(), ds.getPerUserTestWhileIdle("key"));
+        assertEquals(Boolean.FALSE, ds.getPerUserTestWhileIdle("anonymous"));
+    }
+
+    @Test
+    public void testPerUserTestWhileIdleMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Boolean> values = new HashMap<>();
+        values.put("key", Boolean.FALSE);
+        ds.setPerUserTestWhileIdle(values);
+        assertEquals(ds.getDefaultTestWhileIdle(), ds.getPerUserTestWhileIdle("missingkey"));
+    }
+
+    @Test
+    public void testPerUserTestWhileIdleWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserTestWhileIdle(user, Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserTestWhileIdle(user));
+    }
+
+    @Test
+    public void testPerUserTestWhileIdleWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserTestWhileIdle(user, Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserTestWhileIdle(user));
+        ds.setPerUserTestWhileIdle("anotheruser", Boolean.FALSE);
+        assertEquals(Boolean.FALSE, ds.getPerUserTestWhileIdle(user));
+        assertEquals(Boolean.FALSE, ds.getPerUserTestWhileIdle("anotheruser"));
+    }
+
+    @Test
+    public void testPerUserTestWhileIdleWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserTestWhileIdle("whatismyuseragain?", Boolean.FALSE);
+        assertEquals(ds.getDefaultTestWhileIdle(), ds.getPerUserTestWhileIdle("missingkey"));
+    }
+
+    // -- per user time between eviction runs millis
+
+    @Test
+    public void testPerUserTimeBetweenEvictionRunsMillisMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Long> values = new HashMap<>();
+        values.put("key", 1l);
+        ds.setPerUserTimeBetweenEvictionRunsMillis(values);
+        assertEquals(1l, ds.getPerUserTimeBetweenEvictionRunsMillis("key"));
+    }
+
+    @Test
+    public void testPerUserTimeBetweenEvictionRunsMillisMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Long> values = new HashMap<>();
+        values.put("key", 0l);
+        ds.setPerUserTimeBetweenEvictionRunsMillis(values);
+        assertEquals(0l, ds.getPerUserTimeBetweenEvictionRunsMillis("key"));
+        values = new HashMap<>();
+        values.put("anonymous", 0l);
+        ds.setPerUserTimeBetweenEvictionRunsMillis(values);
+        assertEquals(ds.getDefaultTimeBetweenEvictionRunsMillis(), ds.getPerUserTimeBetweenEvictionRunsMillis("key"));
+        assertEquals(0l, ds.getPerUserTimeBetweenEvictionRunsMillis("anonymous"));
+    }
+
+    @Test
+    public void testPerUserTimeBetweenEvictionRunsMillisMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        Map<String, Long> values = new HashMap<>();
+        values.put("key", 0l);
+        ds.setPerUserTimeBetweenEvictionRunsMillis(values);
+        assertEquals(ds.getDefaultTimeBetweenEvictionRunsMillis(), ds.getPerUserTimeBetweenEvictionRunsMillis("missingkey"));
+    }
+
+    @Test
+    public void testPerUserTimeBetweenEvictionRunsMillisWithUserMapNotInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserTimeBetweenEvictionRunsMillis(user, 0l);
+        assertEquals(0l, ds.getPerUserTimeBetweenEvictionRunsMillis(user));
+    }
+
+    @Test
+    public void testPerUserTimeBetweenEvictionRunsMillisWithUserMapInitialized() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserTimeBetweenEvictionRunsMillis(user, 0l);
+        assertEquals(0l, ds.getPerUserTimeBetweenEvictionRunsMillis(user));
+        ds.setPerUserTimeBetweenEvictionRunsMillis("anotheruser", 0l);
+        assertEquals(0l, ds.getPerUserTimeBetweenEvictionRunsMillis(user));
+        assertEquals(0l, ds.getPerUserTimeBetweenEvictionRunsMillis("anotheruser"));
+    }
+
+    @Test
+    public void testPerUserTimeBetweenEvictionRunsMillisWithUserMapNotInitializedMissingKey() {
+        PerUserPoolDataSource ds = (PerUserPoolDataSource) this.ds;
+        ds.setPerUserTimeBetweenEvictionRunsMillis("whatismyuseragain?", 0l);
+        assertEquals(ds.getDefaultTimeBetweenEvictionRunsMillis(), ds.getPerUserTimeBetweenEvictionRunsMillis("missingkey"));
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/datasources/TestPoolKey.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/datasources/TestPoolKey.java b/src/test/java/org/apache/commons/dbcp2/datasources/TestPoolKey.java
new file mode 100644
index 0000000..5df7809
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbcp2/datasources/TestPoolKey.java
@@ -0,0 +1,65 @@
+/*
+ * 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.commons.dbcp2.datasources;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests for PoolKey.
+ * @since 2.5.0
+ */
+public class TestPoolKey {
+
+    private PoolKey poolKey;
+    private PoolKey anotherPoolKey;
+
+    @Before
+    public void setUp() {
+        poolKey = new PoolKey("ds", "user");
+        anotherPoolKey = new PoolKey(null, null);
+    }
+
+    @Test
+    public void testEquals() {
+        assertEquals(poolKey, poolKey);
+        assertNotEquals(poolKey, null);
+        assertNotEquals(poolKey, new Object());
+        assertNotEquals(new PoolKey(null, "user"), poolKey);
+        assertEquals(new PoolKey(null, "user"), new PoolKey(null, "user"));
+        assertNotEquals(new PoolKey(null, "user"), new PoolKey(null, "foo"));
+        assertNotEquals(new PoolKey("ds", null), new PoolKey("foo", null));
+        assertNotEquals(new PoolKey("ds", null), poolKey);
+        assertEquals(new PoolKey("ds", null), new PoolKey("ds", null));
+    }
+
+    @Test
+    public void testHashcode() {
+        assertEquals(poolKey.hashCode(), new PoolKey("ds", "user").hashCode());
+        assertNotEquals(poolKey.hashCode(), anotherPoolKey.hashCode());
+    }
+
+    @Test
+    public void testToString() {
+        assertEquals(poolKey.toString(), new PoolKey("ds", "user").toString());
+        assertNotEquals(poolKey.toString(), anotherPoolKey.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/datasources/TestUserPassKey.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/datasources/TestUserPassKey.java b/src/test/java/org/apache/commons/dbcp2/datasources/TestUserPassKey.java
new file mode 100644
index 0000000..b5fb453
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbcp2/datasources/TestUserPassKey.java
@@ -0,0 +1,74 @@
+/*
+ * 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.commons.dbcp2.datasources;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+
+import org.apache.commons.dbcp2.Utils;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests for UserPassKey.
+ * @since 2.5.0
+ */
+public class TestUserPassKey {
+
+    private UserPassKey userPassKey;
+    private UserPassKey anotherUserPassKey;
+
+    @Before
+    public void setUp() {
+        userPassKey = new UserPassKey("user", "pass");
+        anotherUserPassKey = new UserPassKey((String) null, "");
+    }
+
+    @Test
+    public void testGettersAndSetters() {
+        assertEquals("user", userPassKey.getUsername());
+        assertEquals("pass", userPassKey.getPassword());
+        assertTrue(Arrays.equals(Utils.toCharArray("pass"), userPassKey.getPasswordCharArray()));
+    }
+
+    @Test
+    public void testEquals() {
+        assertEquals(new UserPassKey("user"), new UserPassKey("user", (char[]) null));
+        assertEquals(userPassKey, userPassKey);
+        assertNotEquals(userPassKey, null);
+        assertNotEquals(userPassKey, new Object());
+        assertNotEquals(new UserPassKey(null), userPassKey);
+        assertEquals(new UserPassKey(null), new UserPassKey(null));
+        assertNotEquals(new UserPassKey("user", "pass"), new UserPassKey("foo", "pass"));
+    }
+
+    @Test
+    public void testHashcode() {
+        assertEquals(userPassKey.hashCode(), new UserPassKey("user", "pass").hashCode());
+        assertNotEquals(userPassKey.hashCode(), anotherUserPassKey.hashCode());
+    }
+
+    @Test
+    public void testToString() {
+        assertEquals(userPassKey.toString(), new UserPassKey("user", "pass").toString());
+        assertNotEquals(userPassKey.toString(), anotherUserPassKey.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/managed/TestBasicManagedDataSource.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestBasicManagedDataSource.java b/src/test/java/org/apache/commons/dbcp2/managed/TestBasicManagedDataSource.java
index 7ece885..370158e 100644
--- a/src/test/java/org/apache/commons/dbcp2/managed/TestBasicManagedDataSource.java
+++ b/src/test/java/org/apache/commons/dbcp2/managed/TestBasicManagedDataSource.java
@@ -17,14 +17,21 @@
  */
 package org.apache.commons.dbcp2.managed;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 
 import java.sql.SQLException;
 
+import javax.sql.XADataSource;
+import javax.transaction.xa.XAException;
+
 import org.apache.commons.dbcp2.BasicDataSource;
 import org.apache.commons.dbcp2.TestBasicDataSource;
 import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
+import org.h2.Driver;
+import org.h2.jdbcx.JdbcDataSource;
 import org.junit.Test;
 
 /**
@@ -68,4 +75,100 @@ public class TestBasicManagedDataSource extends TestBasicDataSource {
         conn2.close();
         basicManagedDataSource.close();
     }
+
+    @Test
+    public void testXADataSource() throws SQLException {
+        try (final BasicManagedDataSource basicManagedDataSource = new BasicManagedDataSource()) {
+            basicManagedDataSource.setXADataSource("anything");
+            assertEquals("anything", basicManagedDataSource.getXADataSource());
+        }
+    }
+
+    @Test
+    public void testXaDataSourceInstance() throws SQLException {
+        try (final BasicManagedDataSource basicManagedDataSource = new BasicManagedDataSource()) {
+            XADataSource ds = new JdbcDataSource();
+            basicManagedDataSource.setXaDataSourceInstance(ds);
+            assertEquals(ds, basicManagedDataSource.getXaDataSourceInstance());
+        }
+    }
+
+    @Test(expected=SQLException.class)
+    public void testTransactionManagerNotSet() throws SQLException {
+        try (final BasicManagedDataSource basicManagedDataSource = new BasicManagedDataSource()) {
+            basicManagedDataSource.createConnectionFactory();
+        }
+    }
+
+    @Test
+    public void testSetDriverName() throws SQLException, XAException {
+        try (final BasicManagedDataSource basicManagedDataSource = new BasicManagedDataSource()) {
+            basicManagedDataSource.setDriverClassName("adams");
+            assertEquals("adams", basicManagedDataSource.getDriverClassName());
+            basicManagedDataSource.setDriverClassName(null);
+            assertNull(basicManagedDataSource.getDriverClassName());
+        }
+    }
+
+    @Test
+    public void testCreateXaDataSourceNewInstance() throws SQLException, XAException {
+        try (final BasicManagedDataSource basicManagedDataSource = new BasicManagedDataSource()) {
+            basicManagedDataSource.setXADataSource(JdbcDataSource.class.getCanonicalName());
+            basicManagedDataSource.setDriverClassName(Driver.class.getName());
+            basicManagedDataSource.setTransactionManager(new TransactionManagerImpl());
+            assertNotNull(basicManagedDataSource.createConnectionFactory());
+        }
+    }
+
+    @Test
+    public void testCreateXaDataSourceNoInstanceSetAndNoDataSource() throws SQLException, XAException {
+        try (final BasicManagedDataSource basicManagedDataSource = new BasicManagedDataSource()) {
+            basicManagedDataSource.setDriverClassName("org.apache.commons.dbcp2.TesterDriver");
+            basicManagedDataSource.setUrl("jdbc:apache:commons:testdriver");
+            basicManagedDataSource.setTransactionManager(new TransactionManagerImpl());
+            assertNotNull(basicManagedDataSource.createConnectionFactory());
+        }
+    }
+
+    @Test(expected=NullPointerException.class)
+    public void testRuntimeExceptionsAreRethrown() throws SQLException, XAException {
+        try (final BasicManagedDataSource basicManagedDataSource = new BasicManagedDataSource()) {
+            basicManagedDataSource.setTransactionManager(new TransactionManagerImpl());
+            basicManagedDataSource.setDriverClassName("org.apache.commons.dbcp2.TesterDriver");
+            basicManagedDataSource.setUrl("jdbc:apache:commons:testdriver");
+            basicManagedDataSource.setUsername("userName");
+            basicManagedDataSource.setPassword("password");
+            basicManagedDataSource.setMaxIdle(1);
+            // results in a NPE
+            basicManagedDataSource.createPoolableConnectionFactory(null);
+        }
+    }
+
+    @Test
+    public void testSetXaDataSourceInstance() throws SQLException, XAException {
+        try (final BasicManagedDataSource basicManagedDataSource = new BasicManagedDataSource()) {
+            basicManagedDataSource.setTransactionManager(new TransactionManagerImpl());
+            basicManagedDataSource.setDriverClassName("org.apache.commons.dbcp2.TesterDriver");
+            basicManagedDataSource.setUrl("jdbc:apache:commons:testdriver");
+            basicManagedDataSource.setUsername("userName");
+            basicManagedDataSource.setPassword("password");
+            basicManagedDataSource.setMaxIdle(1);
+            basicManagedDataSource.setXaDataSourceInstance(new JdbcDataSource());
+            assertNotNull(basicManagedDataSource.createConnectionFactory());
+        }
+    }
+
+    @Test
+    public void testSetNullXaDataSourceInstance() throws SQLException, XAException {
+        try (final BasicManagedDataSource basicManagedDataSource = new BasicManagedDataSource()) {
+            basicManagedDataSource.setTransactionManager(new TransactionManagerImpl());
+            basicManagedDataSource.setDriverClassName("org.apache.commons.dbcp2.TesterDriver");
+            basicManagedDataSource.setUrl("jdbc:apache:commons:testdriver");
+            basicManagedDataSource.setUsername("userName");
+            basicManagedDataSource.setPassword("password");
+            basicManagedDataSource.setMaxIdle(1);
+            basicManagedDataSource.setXaDataSourceInstance(null);
+            assertNull(basicManagedDataSource.getXaDataSourceInstance());
+        }
+    }
 }


[4/5] commons-dbcp git commit: [DBCP-504] Increase test coverage. Closes #13.

Posted by gg...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java b/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java
index 03a806b..57a339e 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java
@@ -18,11 +18,16 @@
 package org.apache.commons.dbcp2;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
 
-import java.sql.Connection;
 import java.sql.DatabaseMetaData;
 import java.sql.ResultSet;
+import java.sql.SQLException;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -32,31 +37,1453 @@ import org.junit.Test;
  */
 public class TestDelegatingDatabaseMetaData {
 
-    private DelegatingConnection<Connection> conn = null;
-    private Connection delegateConn = null;
-    private DelegatingDatabaseMetaData meta = null;
-    private DatabaseMetaData delegateMeta = null;
+    private TesterConnection testConn;
+    private DelegatingConnection<?> conn = null;
+    private DelegatingDatabaseMetaData delegate = null;
+    private DatabaseMetaData obj = null;
 
     @Before
     public void setUp() throws Exception {
-        delegateConn = new TesterConnection("test", "test");
-        delegateMeta = delegateConn.getMetaData();
-        conn = new DelegatingConnection<>(delegateConn);
-        meta = new DelegatingDatabaseMetaData(conn,delegateMeta);
+        obj = mock(DatabaseMetaData.class);
+        testConn = new TesterConnection("test", "test");
+        conn = new DelegatingConnection<>(testConn);
+        delegate = new DelegatingDatabaseMetaData(conn, obj);
     }
 
     @Test
     public void testGetDelegate() throws Exception {
-        assertEquals(delegateMeta,meta.getDelegate());
+        assertEquals(obj ,delegate.getDelegate());
     }
 
     @Test
     /* JDBC_4_ANT_KEY_BEGIN */
     public void testCheckOpen() throws Exception {
-        final ResultSet rst = meta.getSchemas();
+        delegate = new DelegatingDatabaseMetaData(conn, conn.getMetaData());
+        final ResultSet rst = delegate.getSchemas();
         assertTrue(!rst.isClosed());
         conn.close();
         assertTrue(rst.isClosed());
     }
     /* JDBC_4_ANT_KEY_END */
+
+    @Test
+    public void testAllProceduresAreCallable() throws Exception {
+        try {
+            delegate.allProceduresAreCallable();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).allProceduresAreCallable();
+    }
+
+    @Test
+    public void testAllTablesAreSelectable() throws Exception {
+        try {
+            delegate.allTablesAreSelectable();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).allTablesAreSelectable();
+    }
+
+    @Test
+    public void testAutoCommitFailureClosesAllResultSets() throws Exception {
+        try {
+            delegate.autoCommitFailureClosesAllResultSets();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).autoCommitFailureClosesAllResultSets();
+    }
+
+    @Test
+    public void testDataDefinitionCausesTransactionCommit() throws Exception {
+        try {
+            delegate.dataDefinitionCausesTransactionCommit();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).dataDefinitionCausesTransactionCommit();
+    }
+
+    @Test
+    public void testDataDefinitionIgnoredInTransactions() throws Exception {
+        try {
+            delegate.dataDefinitionIgnoredInTransactions();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).dataDefinitionIgnoredInTransactions();
+    }
+
+    @Test
+    public void testDeletesAreDetectedInteger() throws Exception {
+        try {
+            delegate.deletesAreDetected(1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).deletesAreDetected(1);
+    }
+
+    @Test
+    public void testDoesMaxRowSizeIncludeBlobs() throws Exception {
+        try {
+            delegate.doesMaxRowSizeIncludeBlobs();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).doesMaxRowSizeIncludeBlobs();
+    }
+
+    @Test
+    public void testGeneratedKeyAlwaysReturned() throws Exception {
+        try {
+            delegate.generatedKeyAlwaysReturned();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).generatedKeyAlwaysReturned();
+    }
+
+    @Test
+    public void testGetAttributesStringStringStringString() throws Exception {
+        try {
+            delegate.getAttributes("foo","foo","foo","foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getAttributes("foo","foo","foo","foo");
+    }
+
+    @Test
+    public void testGetBestRowIdentifierStringStringStringIntegerBoolean() throws Exception {
+        try {
+            delegate.getBestRowIdentifier("foo","foo","foo",1,Boolean.TRUE);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getBestRowIdentifier("foo","foo","foo",1,Boolean.TRUE);
+    }
+
+    @Test
+    public void testGetCatalogSeparator() throws Exception {
+        try {
+            delegate.getCatalogSeparator();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getCatalogSeparator();
+    }
+
+    @Test
+    public void testGetCatalogTerm() throws Exception {
+        try {
+            delegate.getCatalogTerm();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getCatalogTerm();
+    }
+
+    @Test
+    public void testGetCatalogs() throws Exception {
+        try {
+            delegate.getCatalogs();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getCatalogs();
+    }
+
+    @Test
+    public void testGetClientInfoProperties() throws Exception {
+        try {
+            delegate.getClientInfoProperties();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getClientInfoProperties();
+    }
+
+    @Test
+    public void testGetColumnPrivilegesStringStringStringString() throws Exception {
+        try {
+            delegate.getColumnPrivileges("foo","foo","foo","foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getColumnPrivileges("foo","foo","foo","foo");
+    }
+
+    @Test
+    public void testGetColumnsStringStringStringString() throws Exception {
+        try {
+            delegate.getColumns("foo","foo","foo","foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getColumns("foo","foo","foo","foo");
+    }
+
+    /**
+     * This method is a bit special, and doesn't call the method on the wrapped object,
+     * instead returning the connection from the delegate object itself.
+     * @throws Exception
+     */
+    @Test
+    public void testGetConnection() throws Exception {
+        try {
+            delegate.getConnection();
+        } catch (SQLException e) {}
+        verify(obj, times(0)).getConnection();
+    }
+
+    @Test
+    public void testGetCrossReferenceStringStringStringStringStringString() throws Exception {
+        try {
+            delegate.getCrossReference("foo","foo","foo","foo","foo","foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getCrossReference("foo","foo","foo","foo","foo","foo");
+    }
+
+    @Test
+    public void testGetDatabaseMajorVersion() throws Exception {
+        try {
+            delegate.getDatabaseMajorVersion();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getDatabaseMajorVersion();
+    }
+
+    @Test
+    public void testGetDatabaseMinorVersion() throws Exception {
+        try {
+            delegate.getDatabaseMinorVersion();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getDatabaseMinorVersion();
+    }
+
+    @Test
+    public void testGetDatabaseProductName() throws Exception {
+        try {
+            delegate.getDatabaseProductName();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getDatabaseProductName();
+    }
+
+    @Test
+    public void testGetDatabaseProductVersion() throws Exception {
+        try {
+            delegate.getDatabaseProductVersion();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getDatabaseProductVersion();
+    }
+
+    @Test
+    public void testGetDefaultTransactionIsolation() throws Exception {
+        try {
+            delegate.getDefaultTransactionIsolation();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getDefaultTransactionIsolation();
+    }
+
+    @Test
+    public void testGetDriverMajorVersion() throws Exception {
+        delegate.getDriverMajorVersion();
+        verify(obj, times(1)).getDriverMajorVersion();
+    }
+
+    @Test
+    public void testGetDriverMinorVersion() throws Exception {
+        delegate.getDriverMinorVersion();
+        verify(obj, times(1)).getDriverMinorVersion();
+    }
+
+    @Test
+    public void testGetDriverName() throws Exception {
+        try {
+            delegate.getDriverName();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getDriverName();
+    }
+
+    @Test
+    public void testGetDriverVersion() throws Exception {
+        try {
+            delegate.getDriverVersion();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getDriverVersion();
+    }
+
+    @Test
+    public void testGetExportedKeysStringStringString() throws Exception {
+        try {
+            delegate.getExportedKeys("foo","foo","foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getExportedKeys("foo","foo","foo");
+    }
+
+    @Test
+    public void testGetExtraNameCharacters() throws Exception {
+        try {
+            delegate.getExtraNameCharacters();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getExtraNameCharacters();
+    }
+
+    @Test
+    public void testGetFunctionColumnsStringStringStringString() throws Exception {
+        try {
+            delegate.getFunctionColumns("foo","foo","foo","foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getFunctionColumns("foo","foo","foo","foo");
+    }
+
+    @Test
+    public void testGetFunctionsStringStringString() throws Exception {
+        try {
+            delegate.getFunctions("foo","foo","foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getFunctions("foo","foo","foo");
+    }
+
+    @Test
+    public void testGetIdentifierQuoteString() throws Exception {
+        try {
+            delegate.getIdentifierQuoteString();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getIdentifierQuoteString();
+    }
+
+    @Test
+    public void testGetImportedKeysStringStringString() throws Exception {
+        try {
+            delegate.getImportedKeys("foo","foo","foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getImportedKeys("foo","foo","foo");
+    }
+
+    @Test
+    public void testGetIndexInfoStringStringStringBooleanBoolean() throws Exception {
+        try {
+            delegate.getIndexInfo("foo","foo","foo",Boolean.TRUE,Boolean.TRUE);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getIndexInfo("foo","foo","foo",Boolean.TRUE,Boolean.TRUE);
+    }
+
+    @Test
+    public void testGetJDBCMajorVersion() throws Exception {
+        try {
+            delegate.getJDBCMajorVersion();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getJDBCMajorVersion();
+    }
+
+    @Test
+    public void testGetJDBCMinorVersion() throws Exception {
+        try {
+            delegate.getJDBCMinorVersion();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getJDBCMinorVersion();
+    }
+
+    @Test
+    public void testGetMaxBinaryLiteralLength() throws Exception {
+        try {
+            delegate.getMaxBinaryLiteralLength();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxBinaryLiteralLength();
+    }
+
+    @Test
+    public void testGetMaxCatalogNameLength() throws Exception {
+        try {
+            delegate.getMaxCatalogNameLength();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxCatalogNameLength();
+    }
+
+    @Test
+    public void testGetMaxCharLiteralLength() throws Exception {
+        try {
+            delegate.getMaxCharLiteralLength();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxCharLiteralLength();
+    }
+
+    @Test
+    public void testGetMaxColumnNameLength() throws Exception {
+        try {
+            delegate.getMaxColumnNameLength();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxColumnNameLength();
+    }
+
+    @Test
+    public void testGetMaxColumnsInGroupBy() throws Exception {
+        try {
+            delegate.getMaxColumnsInGroupBy();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxColumnsInGroupBy();
+    }
+
+    @Test
+    public void testGetMaxColumnsInIndex() throws Exception {
+        try {
+            delegate.getMaxColumnsInIndex();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxColumnsInIndex();
+    }
+
+    @Test
+    public void testGetMaxColumnsInOrderBy() throws Exception {
+        try {
+            delegate.getMaxColumnsInOrderBy();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxColumnsInOrderBy();
+    }
+
+    @Test
+    public void testGetMaxColumnsInSelect() throws Exception {
+        try {
+            delegate.getMaxColumnsInSelect();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxColumnsInSelect();
+    }
+
+    @Test
+    public void testGetMaxColumnsInTable() throws Exception {
+        try {
+            delegate.getMaxColumnsInTable();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxColumnsInTable();
+    }
+
+    @Test
+    public void testGetMaxConnections() throws Exception {
+        try {
+            delegate.getMaxConnections();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxConnections();
+    }
+
+    @Test
+    public void testGetMaxCursorNameLength() throws Exception {
+        try {
+            delegate.getMaxCursorNameLength();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxCursorNameLength();
+    }
+
+    @Test
+    public void testGetMaxIndexLength() throws Exception {
+        try {
+            delegate.getMaxIndexLength();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxIndexLength();
+    }
+
+    @Test
+    public void testGetMaxLogicalLobSize() throws Exception {
+        try {
+            delegate.getMaxLogicalLobSize();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxLogicalLobSize();
+    }
+
+    @Test
+    public void testGetMaxProcedureNameLength() throws Exception {
+        try {
+            delegate.getMaxProcedureNameLength();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxProcedureNameLength();
+    }
+
+    @Test
+    public void testGetMaxRowSize() throws Exception {
+        try {
+            delegate.getMaxRowSize();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxRowSize();
+    }
+
+    @Test
+    public void testGetMaxSchemaNameLength() throws Exception {
+        try {
+            delegate.getMaxSchemaNameLength();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxSchemaNameLength();
+    }
+
+    @Test
+    public void testGetMaxStatementLength() throws Exception {
+        try {
+            delegate.getMaxStatementLength();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxStatementLength();
+    }
+
+    @Test
+    public void testGetMaxStatements() throws Exception {
+        try {
+            delegate.getMaxStatements();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxStatements();
+    }
+
+    @Test
+    public void testGetMaxTableNameLength() throws Exception {
+        try {
+            delegate.getMaxTableNameLength();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxTableNameLength();
+    }
+
+    @Test
+    public void testGetMaxTablesInSelect() throws Exception {
+        try {
+            delegate.getMaxTablesInSelect();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxTablesInSelect();
+    }
+
+    @Test
+    public void testGetMaxUserNameLength() throws Exception {
+        try {
+            delegate.getMaxUserNameLength();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMaxUserNameLength();
+    }
+
+    @Test
+    public void testGetNumericFunctions() throws Exception {
+        try {
+            delegate.getNumericFunctions();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getNumericFunctions();
+    }
+
+    @Test
+    public void testGetPrimaryKeysStringStringString() throws Exception {
+        try {
+            delegate.getPrimaryKeys("foo","foo","foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getPrimaryKeys("foo","foo","foo");
+    }
+
+    @Test
+    public void testGetProcedureColumnsStringStringStringString() throws Exception {
+        try {
+            delegate.getProcedureColumns("foo","foo","foo","foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getProcedureColumns("foo","foo","foo","foo");
+    }
+
+    @Test
+    public void testGetProcedureTerm() throws Exception {
+        try {
+            delegate.getProcedureTerm();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getProcedureTerm();
+    }
+
+    @Test
+    public void testGetProceduresStringStringString() throws Exception {
+        try {
+            delegate.getProcedures("foo","foo","foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getProcedures("foo","foo","foo");
+    }
+
+    @Test
+    public void testGetPseudoColumnsStringStringStringString() throws Exception {
+        try {
+            delegate.getPseudoColumns("foo","foo","foo","foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getPseudoColumns("foo","foo","foo","foo");
+    }
+
+    @Test
+    public void testGetResultSetHoldability() throws Exception {
+        try {
+            delegate.getResultSetHoldability();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getResultSetHoldability();
+    }
+
+    @Test
+    public void testGetRowIdLifetime() throws Exception {
+        try {
+            delegate.getRowIdLifetime();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getRowIdLifetime();
+    }
+
+    @Test
+    public void testGetSQLKeywords() throws Exception {
+        try {
+            delegate.getSQLKeywords();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getSQLKeywords();
+    }
+
+    @Test
+    public void testGetSQLStateType() throws Exception {
+        try {
+            delegate.getSQLStateType();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getSQLStateType();
+    }
+
+    @Test
+    public void testGetSchemaTerm() throws Exception {
+        try {
+            delegate.getSchemaTerm();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getSchemaTerm();
+    }
+
+    @Test
+    public void testGetSchemasStringString() throws Exception {
+        try {
+            delegate.getSchemas("foo","foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getSchemas("foo","foo");
+    }
+
+    @Test
+    public void testGetSchemas() throws Exception {
+        try {
+            delegate.getSchemas();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getSchemas();
+    }
+
+    @Test
+    public void testGetSearchStringEscape() throws Exception {
+        try {
+            delegate.getSearchStringEscape();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getSearchStringEscape();
+    }
+
+    @Test
+    public void testGetStringFunctions() throws Exception {
+        try {
+            delegate.getStringFunctions();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getStringFunctions();
+    }
+
+    @Test
+    public void testGetSuperTablesStringStringString() throws Exception {
+        try {
+            delegate.getSuperTables("foo","foo","foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getSuperTables("foo","foo","foo");
+    }
+
+    @Test
+    public void testGetSuperTypesStringStringString() throws Exception {
+        try {
+            delegate.getSuperTypes("foo","foo","foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getSuperTypes("foo","foo","foo");
+    }
+
+    @Test
+    public void testGetSystemFunctions() throws Exception {
+        try {
+            delegate.getSystemFunctions();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getSystemFunctions();
+    }
+
+    @Test
+    public void testGetTablePrivilegesStringStringString() throws Exception {
+        try {
+            delegate.getTablePrivileges("foo","foo","foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getTablePrivileges("foo","foo","foo");
+    }
+
+    @Test
+    public void testGetTableTypes() throws Exception {
+        try {
+            delegate.getTableTypes();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getTableTypes();
+    }
+
+    @Test
+    public void testGetTablesStringStringStringStringArray() throws Exception {
+        try {
+            delegate.getTables("foo","foo","foo",(String[]) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getTables("foo","foo","foo",(String[]) null);
+    }
+
+    @Test
+    public void testGetTimeDateFunctions() throws Exception {
+        try {
+            delegate.getTimeDateFunctions();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getTimeDateFunctions();
+    }
+
+    @Test
+    public void testGetTypeInfo() throws Exception {
+        try {
+            delegate.getTypeInfo();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getTypeInfo();
+    }
+
+    @Test
+    public void testGetUDTsStringStringStringIntegerArray() throws Exception {
+        try {
+            delegate.getUDTs("foo","foo","foo",(int[]) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getUDTs("foo","foo","foo",(int[]) null);
+    }
+
+    @Test
+    public void testGetURL() throws Exception {
+        try {
+            delegate.getURL();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getURL();
+    }
+
+    @Test
+    public void testGetUserName() throws Exception {
+        try {
+            delegate.getUserName();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getUserName();
+    }
+
+    @Test
+    public void testGetVersionColumnsStringStringString() throws Exception {
+        try {
+            delegate.getVersionColumns("foo","foo","foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getVersionColumns("foo","foo","foo");
+    }
+
+    @Test
+    public void testInsertsAreDetectedInteger() throws Exception {
+        try {
+            delegate.insertsAreDetected(1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).insertsAreDetected(1);
+    }
+
+    @Test
+    public void testIsCatalogAtStart() throws Exception {
+        try {
+            delegate.isCatalogAtStart();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).isCatalogAtStart();
+    }
+
+    @Test
+    public void testIsReadOnly() throws Exception {
+        try {
+            delegate.isReadOnly();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).isReadOnly();
+    }
+
+    @Test
+    public void testLocatorsUpdateCopy() throws Exception {
+        try {
+            delegate.locatorsUpdateCopy();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).locatorsUpdateCopy();
+    }
+
+    @Test
+    public void testNullPlusNonNullIsNull() throws Exception {
+        try {
+            delegate.nullPlusNonNullIsNull();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).nullPlusNonNullIsNull();
+    }
+
+    @Test
+    public void testNullsAreSortedAtEnd() throws Exception {
+        try {
+            delegate.nullsAreSortedAtEnd();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).nullsAreSortedAtEnd();
+    }
+
+    @Test
+    public void testNullsAreSortedAtStart() throws Exception {
+        try {
+            delegate.nullsAreSortedAtStart();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).nullsAreSortedAtStart();
+    }
+
+    @Test
+    public void testNullsAreSortedHigh() throws Exception {
+        try {
+            delegate.nullsAreSortedHigh();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).nullsAreSortedHigh();
+    }
+
+    @Test
+    public void testNullsAreSortedLow() throws Exception {
+        try {
+            delegate.nullsAreSortedLow();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).nullsAreSortedLow();
+    }
+
+    @Test
+    public void testOthersDeletesAreVisibleInteger() throws Exception {
+        try {
+            delegate.othersDeletesAreVisible(1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).othersDeletesAreVisible(1);
+    }
+
+    @Test
+    public void testOthersInsertsAreVisibleInteger() throws Exception {
+        try {
+            delegate.othersInsertsAreVisible(1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).othersInsertsAreVisible(1);
+    }
+
+    @Test
+    public void testOthersUpdatesAreVisibleInteger() throws Exception {
+        try {
+            delegate.othersUpdatesAreVisible(1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).othersUpdatesAreVisible(1);
+    }
+
+    @Test
+    public void testOwnDeletesAreVisibleInteger() throws Exception {
+        try {
+            delegate.ownDeletesAreVisible(1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).ownDeletesAreVisible(1);
+    }
+
+    @Test
+    public void testOwnInsertsAreVisibleInteger() throws Exception {
+        try {
+            delegate.ownInsertsAreVisible(1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).ownInsertsAreVisible(1);
+    }
+
+    @Test
+    public void testOwnUpdatesAreVisibleInteger() throws Exception {
+        try {
+            delegate.ownUpdatesAreVisible(1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).ownUpdatesAreVisible(1);
+    }
+
+    @Test
+    public void testStoresLowerCaseIdentifiers() throws Exception {
+        try {
+            delegate.storesLowerCaseIdentifiers();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).storesLowerCaseIdentifiers();
+    }
+
+    @Test
+    public void testStoresLowerCaseQuotedIdentifiers() throws Exception {
+        try {
+            delegate.storesLowerCaseQuotedIdentifiers();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).storesLowerCaseQuotedIdentifiers();
+    }
+
+    @Test
+    public void testStoresMixedCaseIdentifiers() throws Exception {
+        try {
+            delegate.storesMixedCaseIdentifiers();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).storesMixedCaseIdentifiers();
+    }
+
+    @Test
+    public void testStoresMixedCaseQuotedIdentifiers() throws Exception {
+        try {
+            delegate.storesMixedCaseQuotedIdentifiers();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).storesMixedCaseQuotedIdentifiers();
+    }
+
+    @Test
+    public void testStoresUpperCaseIdentifiers() throws Exception {
+        try {
+            delegate.storesUpperCaseIdentifiers();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).storesUpperCaseIdentifiers();
+    }
+
+    @Test
+    public void testStoresUpperCaseQuotedIdentifiers() throws Exception {
+        try {
+            delegate.storesUpperCaseQuotedIdentifiers();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).storesUpperCaseQuotedIdentifiers();
+    }
+
+    @Test
+    public void testSupportsANSI92EntryLevelSQL() throws Exception {
+        try {
+            delegate.supportsANSI92EntryLevelSQL();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsANSI92EntryLevelSQL();
+    }
+
+    @Test
+    public void testSupportsANSI92FullSQL() throws Exception {
+        try {
+            delegate.supportsANSI92FullSQL();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsANSI92FullSQL();
+    }
+
+    @Test
+    public void testSupportsANSI92IntermediateSQL() throws Exception {
+        try {
+            delegate.supportsANSI92IntermediateSQL();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsANSI92IntermediateSQL();
+    }
+
+    @Test
+    public void testSupportsAlterTableWithAddColumn() throws Exception {
+        try {
+            delegate.supportsAlterTableWithAddColumn();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsAlterTableWithAddColumn();
+    }
+
+    @Test
+    public void testSupportsAlterTableWithDropColumn() throws Exception {
+        try {
+            delegate.supportsAlterTableWithDropColumn();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsAlterTableWithDropColumn();
+    }
+
+    @Test
+    public void testSupportsBatchUpdates() throws Exception {
+        try {
+            delegate.supportsBatchUpdates();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsBatchUpdates();
+    }
+
+    @Test
+    public void testSupportsCatalogsInDataManipulation() throws Exception {
+        try {
+            delegate.supportsCatalogsInDataManipulation();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsCatalogsInDataManipulation();
+    }
+
+    @Test
+    public void testSupportsCatalogsInIndexDefinitions() throws Exception {
+        try {
+            delegate.supportsCatalogsInIndexDefinitions();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsCatalogsInIndexDefinitions();
+    }
+
+    @Test
+    public void testSupportsCatalogsInPrivilegeDefinitions() throws Exception {
+        try {
+            delegate.supportsCatalogsInPrivilegeDefinitions();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsCatalogsInPrivilegeDefinitions();
+    }
+
+    @Test
+    public void testSupportsCatalogsInProcedureCalls() throws Exception {
+        try {
+            delegate.supportsCatalogsInProcedureCalls();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsCatalogsInProcedureCalls();
+    }
+
+    @Test
+    public void testSupportsCatalogsInTableDefinitions() throws Exception {
+        try {
+            delegate.supportsCatalogsInTableDefinitions();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsCatalogsInTableDefinitions();
+    }
+
+    @Test
+    public void testSupportsColumnAliasing() throws Exception {
+        try {
+            delegate.supportsColumnAliasing();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsColumnAliasing();
+    }
+
+    @Test
+    public void testSupportsConvertIntegerInteger() throws Exception {
+        try {
+            delegate.supportsConvert(1,1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsConvert(1,1);
+    }
+
+    @Test
+    public void testSupportsConvert() throws Exception {
+        try {
+            delegate.supportsConvert();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsConvert();
+    }
+
+    @Test
+    public void testSupportsCoreSQLGrammar() throws Exception {
+        try {
+            delegate.supportsCoreSQLGrammar();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsCoreSQLGrammar();
+    }
+
+    @Test
+    public void testSupportsCorrelatedSubqueries() throws Exception {
+        try {
+            delegate.supportsCorrelatedSubqueries();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsCorrelatedSubqueries();
+    }
+
+    @Test
+    public void testSupportsDataDefinitionAndDataManipulationTransactions() throws Exception {
+        try {
+            delegate.supportsDataDefinitionAndDataManipulationTransactions();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsDataDefinitionAndDataManipulationTransactions();
+    }
+
+    @Test
+    public void testSupportsDataManipulationTransactionsOnly() throws Exception {
+        try {
+            delegate.supportsDataManipulationTransactionsOnly();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsDataManipulationTransactionsOnly();
+    }
+
+    @Test
+    public void testSupportsDifferentTableCorrelationNames() throws Exception {
+        try {
+            delegate.supportsDifferentTableCorrelationNames();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsDifferentTableCorrelationNames();
+    }
+
+    @Test
+    public void testSupportsExpressionsInOrderBy() throws Exception {
+        try {
+            delegate.supportsExpressionsInOrderBy();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsExpressionsInOrderBy();
+    }
+
+    @Test
+    public void testSupportsExtendedSQLGrammar() throws Exception {
+        try {
+            delegate.supportsExtendedSQLGrammar();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsExtendedSQLGrammar();
+    }
+
+    @Test
+    public void testSupportsFullOuterJoins() throws Exception {
+        try {
+            delegate.supportsFullOuterJoins();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsFullOuterJoins();
+    }
+
+    @Test
+    public void testSupportsGetGeneratedKeys() throws Exception {
+        try {
+            delegate.supportsGetGeneratedKeys();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsGetGeneratedKeys();
+    }
+
+    @Test
+    public void testSupportsGroupBy() throws Exception {
+        try {
+            delegate.supportsGroupBy();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsGroupBy();
+    }
+
+    @Test
+    public void testSupportsGroupByBeyondSelect() throws Exception {
+        try {
+            delegate.supportsGroupByBeyondSelect();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsGroupByBeyondSelect();
+    }
+
+    @Test
+    public void testSupportsGroupByUnrelated() throws Exception {
+        try {
+            delegate.supportsGroupByUnrelated();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsGroupByUnrelated();
+    }
+
+    @Test
+    public void testSupportsIntegrityEnhancementFacility() throws Exception {
+        try {
+            delegate.supportsIntegrityEnhancementFacility();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsIntegrityEnhancementFacility();
+    }
+
+    @Test
+    public void testSupportsLikeEscapeClause() throws Exception {
+        try {
+            delegate.supportsLikeEscapeClause();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsLikeEscapeClause();
+    }
+
+    @Test
+    public void testSupportsLimitedOuterJoins() throws Exception {
+        try {
+            delegate.supportsLimitedOuterJoins();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsLimitedOuterJoins();
+    }
+
+    @Test
+    public void testSupportsMinimumSQLGrammar() throws Exception {
+        try {
+            delegate.supportsMinimumSQLGrammar();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsMinimumSQLGrammar();
+    }
+
+    @Test
+    public void testSupportsMixedCaseIdentifiers() throws Exception {
+        try {
+            delegate.supportsMixedCaseIdentifiers();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsMixedCaseIdentifiers();
+    }
+
+    @Test
+    public void testSupportsMixedCaseQuotedIdentifiers() throws Exception {
+        try {
+            delegate.supportsMixedCaseQuotedIdentifiers();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsMixedCaseQuotedIdentifiers();
+    }
+
+    @Test
+    public void testSupportsMultipleOpenResults() throws Exception {
+        try {
+            delegate.supportsMultipleOpenResults();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsMultipleOpenResults();
+    }
+
+    @Test
+    public void testSupportsMultipleResultSets() throws Exception {
+        try {
+            delegate.supportsMultipleResultSets();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsMultipleResultSets();
+    }
+
+    @Test
+    public void testSupportsMultipleTransactions() throws Exception {
+        try {
+            delegate.supportsMultipleTransactions();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsMultipleTransactions();
+    }
+
+    @Test
+    public void testSupportsNamedParameters() throws Exception {
+        try {
+            delegate.supportsNamedParameters();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsNamedParameters();
+    }
+
+    @Test
+    public void testSupportsNonNullableColumns() throws Exception {
+        try {
+            delegate.supportsNonNullableColumns();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsNonNullableColumns();
+    }
+
+    @Test
+    public void testSupportsOpenCursorsAcrossCommit() throws Exception {
+        try {
+            delegate.supportsOpenCursorsAcrossCommit();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsOpenCursorsAcrossCommit();
+    }
+
+    @Test
+    public void testSupportsOpenCursorsAcrossRollback() throws Exception {
+        try {
+            delegate.supportsOpenCursorsAcrossRollback();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsOpenCursorsAcrossRollback();
+    }
+
+    @Test
+    public void testSupportsOpenStatementsAcrossCommit() throws Exception {
+        try {
+            delegate.supportsOpenStatementsAcrossCommit();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsOpenStatementsAcrossCommit();
+    }
+
+    @Test
+    public void testSupportsOpenStatementsAcrossRollback() throws Exception {
+        try {
+            delegate.supportsOpenStatementsAcrossRollback();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsOpenStatementsAcrossRollback();
+    }
+
+    @Test
+    public void testSupportsOrderByUnrelated() throws Exception {
+        try {
+            delegate.supportsOrderByUnrelated();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsOrderByUnrelated();
+    }
+
+    @Test
+    public void testSupportsOuterJoins() throws Exception {
+        try {
+            delegate.supportsOuterJoins();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsOuterJoins();
+    }
+
+    @Test
+    public void testSupportsPositionedDelete() throws Exception {
+        try {
+            delegate.supportsPositionedDelete();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsPositionedDelete();
+    }
+
+    @Test
+    public void testSupportsPositionedUpdate() throws Exception {
+        try {
+            delegate.supportsPositionedUpdate();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsPositionedUpdate();
+    }
+
+    @Test
+    public void testSupportsRefCursors() throws Exception {
+        try {
+            delegate.supportsRefCursors();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsRefCursors();
+    }
+
+    @Test
+    public void testSupportsResultSetConcurrencyIntegerInteger() throws Exception {
+        try {
+            delegate.supportsResultSetConcurrency(1,1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsResultSetConcurrency(1,1);
+    }
+
+    @Test
+    public void testSupportsResultSetHoldabilityInteger() throws Exception {
+        try {
+            delegate.supportsResultSetHoldability(1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsResultSetHoldability(1);
+    }
+
+    @Test
+    public void testSupportsResultSetTypeInteger() throws Exception {
+        try {
+            delegate.supportsResultSetType(1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsResultSetType(1);
+    }
+
+    @Test
+    public void testSupportsSavepoints() throws Exception {
+        try {
+            delegate.supportsSavepoints();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsSavepoints();
+    }
+
+    @Test
+    public void testSupportsSchemasInDataManipulation() throws Exception {
+        try {
+            delegate.supportsSchemasInDataManipulation();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsSchemasInDataManipulation();
+    }
+
+    @Test
+    public void testSupportsSchemasInIndexDefinitions() throws Exception {
+        try {
+            delegate.supportsSchemasInIndexDefinitions();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsSchemasInIndexDefinitions();
+    }
+
+    @Test
+    public void testSupportsSchemasInPrivilegeDefinitions() throws Exception {
+        try {
+            delegate.supportsSchemasInPrivilegeDefinitions();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsSchemasInPrivilegeDefinitions();
+    }
+
+    @Test
+    public void testSupportsSchemasInProcedureCalls() throws Exception {
+        try {
+            delegate.supportsSchemasInProcedureCalls();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsSchemasInProcedureCalls();
+    }
+
+    @Test
+    public void testSupportsSchemasInTableDefinitions() throws Exception {
+        try {
+            delegate.supportsSchemasInTableDefinitions();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsSchemasInTableDefinitions();
+    }
+
+    @Test
+    public void testSupportsSelectForUpdate() throws Exception {
+        try {
+            delegate.supportsSelectForUpdate();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsSelectForUpdate();
+    }
+
+    @Test
+    public void testSupportsStatementPooling() throws Exception {
+        try {
+            delegate.supportsStatementPooling();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsStatementPooling();
+    }
+
+    @Test
+    public void testSupportsStoredFunctionsUsingCallSyntax() throws Exception {
+        try {
+            delegate.supportsStoredFunctionsUsingCallSyntax();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsStoredFunctionsUsingCallSyntax();
+    }
+
+    @Test
+    public void testSupportsStoredProcedures() throws Exception {
+        try {
+            delegate.supportsStoredProcedures();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsStoredProcedures();
+    }
+
+    @Test
+    public void testSupportsSubqueriesInComparisons() throws Exception {
+        try {
+            delegate.supportsSubqueriesInComparisons();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsSubqueriesInComparisons();
+    }
+
+    @Test
+    public void testSupportsSubqueriesInExists() throws Exception {
+        try {
+            delegate.supportsSubqueriesInExists();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsSubqueriesInExists();
+    }
+
+    @Test
+    public void testSupportsSubqueriesInIns() throws Exception {
+        try {
+            delegate.supportsSubqueriesInIns();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsSubqueriesInIns();
+    }
+
+    @Test
+    public void testSupportsSubqueriesInQuantifieds() throws Exception {
+        try {
+            delegate.supportsSubqueriesInQuantifieds();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsSubqueriesInQuantifieds();
+    }
+
+    @Test
+    public void testSupportsTableCorrelationNames() throws Exception {
+        try {
+            delegate.supportsTableCorrelationNames();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsTableCorrelationNames();
+    }
+
+    @Test
+    public void testSupportsTransactionIsolationLevelInteger() throws Exception {
+        try {
+            delegate.supportsTransactionIsolationLevel(1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsTransactionIsolationLevel(1);
+    }
+
+    @Test
+    public void testSupportsTransactions() throws Exception {
+        try {
+            delegate.supportsTransactions();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsTransactions();
+    }
+
+    @Test
+    public void testSupportsUnion() throws Exception {
+        try {
+            delegate.supportsUnion();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsUnion();
+    }
+
+    @Test
+    public void testSupportsUnionAll() throws Exception {
+        try {
+            delegate.supportsUnionAll();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).supportsUnionAll();
+    }
+
+    @Test
+    public void testUpdatesAreDetectedInteger() throws Exception {
+        try {
+            delegate.updatesAreDetected(1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).updatesAreDetected(1);
+    }
+
+    @Test
+    public void testUsesLocalFilePerTable() throws Exception {
+        try {
+            delegate.usesLocalFilePerTable();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).usesLocalFilePerTable();
+    }
+
+    @Test
+    public void testUsesLocalFiles() throws Exception {
+        try {
+            delegate.usesLocalFiles();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).usesLocalFiles();
+    }
+
+    @Test
+    public void testWrap() throws SQLException {
+        assertEquals(delegate, delegate.unwrap(DatabaseMetaData.class));
+        assertEquals(delegate, delegate.unwrap(DelegatingDatabaseMetaData.class));
+        assertEquals(obj, delegate.unwrap(obj.getClass()));
+        assertNull(delegate.unwrap(String.class));
+        assertTrue(delegate.isWrapperFor(DatabaseMetaData.class));
+        assertTrue(delegate.isWrapperFor(DelegatingDatabaseMetaData.class));
+        assertTrue(delegate.isWrapperFor(obj.getClass()));
+        assertFalse(delegate.isWrapperFor(String.class));
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/TestDelegatingPreparedStatement.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbcp2/TestDelegatingPreparedStatement.java b/src/test/java/org/apache/commons/dbcp2/TestDelegatingPreparedStatement.java
index fc5890a..af60ae2 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestDelegatingPreparedStatement.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestDelegatingPreparedStatement.java
@@ -20,46 +20,515 @@ package org.apache.commons.dbcp2;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
 
-import java.sql.Connection;
 import java.sql.PreparedStatement;
+import java.sql.SQLException;
 
 import org.junit.Before;
 import org.junit.Test;
 
-/**
- */
+@SuppressWarnings({ "deprecation", "rawtypes" }) // BigDecimal methods, and casting for mocks
 public class TestDelegatingPreparedStatement {
 
-    private DelegatingConnection<Connection> conn = null;
-    private Connection delegateConn = null;
-    private DelegatingPreparedStatement stmt = null;
-    private PreparedStatement delegateStmt = null;
+    private TesterConnection testerConn = null;
+    private DelegatingConnection connection = null;
+    private PreparedStatement obj = null;
+    private DelegatingPreparedStatement delegate = null;
 
     @Before
     public void setUp() throws Exception {
-        delegateConn = new TesterConnection("test", "test");
-        conn = new DelegatingConnection<>(delegateConn);
+        testerConn = new TesterConnection("test", "test");
+        connection = new DelegatingConnection<>(testerConn);
+        obj =  mock(PreparedStatement.class);
+        delegate = new DelegatingPreparedStatement(connection, obj);
     }
 
     @Test
     public void testExecuteQueryReturnsNull() throws Exception {
-        delegateStmt = new TesterPreparedStatement(delegateConn,"null");
-        stmt = new DelegatingPreparedStatement(conn,delegateStmt);
-        assertNull(stmt.executeQuery());
+        obj = new TesterPreparedStatement(testerConn,"null");
+        delegate = new DelegatingPreparedStatement(connection,obj);
+        assertNull(delegate.executeQuery());
     }
 
     @Test
     public void testExecuteQueryReturnsNotNull() throws Exception {
-        delegateStmt = new TesterPreparedStatement(delegateConn,"select * from foo");
-        stmt = new DelegatingPreparedStatement(conn,delegateStmt);
-        assertTrue(null != stmt.executeQuery());
+        obj = new TesterPreparedStatement(testerConn,"select * from foo");
+        delegate = new DelegatingPreparedStatement(connection,obj);
+        assertTrue(null != delegate.executeQuery());
     }
 
     @Test
     public void testGetDelegate() throws Exception {
-        delegateStmt = new TesterPreparedStatement(delegateConn,"select * from foo");
-        stmt = new DelegatingPreparedStatement(conn,delegateStmt);
-        assertEquals(delegateStmt,stmt.getDelegate());
+        obj = new TesterPreparedStatement(testerConn,"select * from foo");
+        delegate = new DelegatingPreparedStatement(connection,obj);
+        assertEquals(obj,delegate.getDelegate());
+    }
+
+    @Test
+    public void testAddBatch() throws Exception {
+        try {
+            delegate.addBatch();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).addBatch();
+    }
+
+    @Test
+    public void testClearParameters() throws Exception {
+        try {
+            delegate.clearParameters();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).clearParameters();
+    }
+
+    @Test
+    public void testExecute() throws Exception {
+        try {
+            delegate.execute();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).execute();
+    }
+
+    @Test
+    public void testExecuteLargeUpdate() throws Exception {
+        try {
+            delegate.executeLargeUpdate();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).executeLargeUpdate();
+    }
+
+    @Test
+    public void testExecuteQuery() throws Exception {
+        try {
+            delegate.executeQuery();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).executeQuery();
+    }
+
+    @Test
+    public void testExecuteUpdate() throws Exception {
+        try {
+            delegate.executeUpdate();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).executeUpdate();
+    }
+
+    @Test
+    public void testGetMetaData() throws Exception {
+        try {
+            delegate.getMetaData();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getMetaData();
+    }
+
+    @Test
+    public void testGetParameterMetaData() throws Exception {
+        try {
+            delegate.getParameterMetaData();
+        } catch (SQLException e) {}
+        verify(obj, times(1)).getParameterMetaData();
+    }
+
+    @Test
+    public void testSetArrayIntegerArray() throws Exception {
+        try {
+            delegate.setArray(1,(java.sql.Array) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setArray(1,(java.sql.Array) null);
+    }
+
+    @Test
+    public void testSetAsciiStreamIntegerInputStreamLong() throws Exception {
+        try {
+            delegate.setAsciiStream(1,(java.io.InputStream) null,1l);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setAsciiStream(1,(java.io.InputStream) null,1l);
+    }
+
+    @Test
+    public void testSetAsciiStreamIntegerInputStreamInteger() throws Exception {
+        try {
+            delegate.setAsciiStream(1,(java.io.InputStream) null,1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setAsciiStream(1,(java.io.InputStream) null,1);
+    }
+
+    @Test
+    public void testSetAsciiStreamIntegerInputStream() throws Exception {
+        try {
+            delegate.setAsciiStream(1,(java.io.InputStream) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setAsciiStream(1,(java.io.InputStream) null);
+    }
+
+    @Test
+    public void testSetBigDecimalIntegerBigDecimal() throws Exception {
+        try {
+            delegate.setBigDecimal(1,java.math.BigDecimal.valueOf(1.0d));
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setBigDecimal(1,java.math.BigDecimal.valueOf(1.0d));
+    }
+
+    @Test
+    public void testSetBinaryStreamIntegerInputStreamLong() throws Exception {
+        try {
+            delegate.setBinaryStream(1,(java.io.InputStream) null,1l);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setBinaryStream(1,(java.io.InputStream) null,1l);
+    }
+
+    @Test
+    public void testSetBinaryStreamIntegerInputStream() throws Exception {
+        try {
+            delegate.setBinaryStream(1,(java.io.InputStream) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setBinaryStream(1,(java.io.InputStream) null);
+    }
+
+    @Test
+    public void testSetBinaryStreamIntegerInputStreamInteger() throws Exception {
+        try {
+            delegate.setBinaryStream(1,(java.io.InputStream) null,1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setBinaryStream(1,(java.io.InputStream) null,1);
+    }
+
+    @Test
+    public void testSetBlobIntegerBlob() throws Exception {
+        try {
+            delegate.setBlob(1,(java.sql.Blob) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setBlob(1,(java.sql.Blob) null);
+    }
+
+    @Test
+    public void testSetBlobIntegerInputStream() throws Exception {
+        try {
+            delegate.setBlob(1,(java.io.InputStream) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setBlob(1,(java.io.InputStream) null);
+    }
+
+    @Test
+    public void testSetBlobIntegerInputStreamLong() throws Exception {
+        try {
+            delegate.setBlob(1,(java.io.InputStream) null,1l);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setBlob(1,(java.io.InputStream) null,1l);
+    }
+
+    @Test
+    public void testSetBooleanIntegerBoolean() throws Exception {
+        try {
+            delegate.setBoolean(1,Boolean.TRUE);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setBoolean(1,Boolean.TRUE);
+    }
+
+    @Test
+    public void testSetByteIntegerByte() throws Exception {
+        try {
+            delegate.setByte(1,(byte) 1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setByte(1,(byte) 1);
+    }
+
+    @Test
+    public void testSetBytesIntegerByteArray() throws Exception {
+        try {
+            delegate.setBytes(1,new byte[] { 1 });
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setBytes(1,new byte[] { 1 });
+    }
+
+    @Test
+    public void testSetCharacterStreamIntegerReader() throws Exception {
+        try {
+            delegate.setCharacterStream(1,(java.io.StringReader) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setCharacterStream(1,(java.io.StringReader) null);
+    }
+
+    @Test
+    public void testSetCharacterStreamIntegerReaderInteger() throws Exception {
+        try {
+            delegate.setCharacterStream(1,(java.io.StringReader) null,1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setCharacterStream(1,(java.io.StringReader) null,1);
+    }
+
+    @Test
+    public void testSetCharacterStreamIntegerReaderLong() throws Exception {
+        try {
+            delegate.setCharacterStream(1,(java.io.StringReader) null,1l);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setCharacterStream(1,(java.io.StringReader) null,1l);
+    }
+
+    @Test
+    public void testSetClobIntegerClob() throws Exception {
+        try {
+            delegate.setClob(1,(java.sql.Clob) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setClob(1,(java.sql.Clob) null);
+    }
+
+    @Test
+    public void testSetClobIntegerReaderLong() throws Exception {
+        try {
+            delegate.setClob(1,(java.io.StringReader) null,1l);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setClob(1,(java.io.StringReader) null,1l);
+    }
+
+    @Test
+    public void testSetClobIntegerReader() throws Exception {
+        try {
+            delegate.setClob(1,(java.io.StringReader) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setClob(1,(java.io.StringReader) null);
+    }
+
+    @Test
+    public void testSetDateIntegerSqlDateCalendar() throws Exception {
+        try {
+            delegate.setDate(1,new java.sql.Date(1529827548745l),(java.util.Calendar) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setDate(1,new java.sql.Date(1529827548745l),(java.util.Calendar) null);
     }
+
+    @Test
+    public void testSetDateIntegerSqlDate() throws Exception {
+        try {
+            delegate.setDate(1,new java.sql.Date(1529827548745l));
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setDate(1,new java.sql.Date(1529827548745l));
+    }
+
+    @Test
+    public void testSetDoubleIntegerDouble() throws Exception {
+        try {
+            delegate.setDouble(1,1.0d);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setDouble(1,1.0d);
+    }
+
+    @Test
+    public void testSetFloatIntegerFloat() throws Exception {
+        try {
+            delegate.setFloat(1,1.0f);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setFloat(1,1.0f);
+    }
+
+    @Test
+    public void testSetIntIntegerInteger() throws Exception {
+        try {
+            delegate.setInt(1,1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setInt(1,1);
+    }
+
+    @Test
+    public void testSetLongIntegerLong() throws Exception {
+        try {
+            delegate.setLong(1,1l);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setLong(1,1l);
+    }
+
+    @Test
+    public void testSetNCharacterStreamIntegerReader() throws Exception {
+        try {
+            delegate.setNCharacterStream(1,(java.io.StringReader) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setNCharacterStream(1,(java.io.StringReader) null);
+    }
+
+    @Test
+    public void testSetNCharacterStreamIntegerReaderLong() throws Exception {
+        try {
+            delegate.setNCharacterStream(1,(java.io.StringReader) null,1l);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setNCharacterStream(1,(java.io.StringReader) null,1l);
+    }
+
+    @Test
+    public void testSetNClobIntegerNClob() throws Exception {
+        try {
+            delegate.setNClob(1,(java.sql.NClob) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setNClob(1,(java.sql.NClob) null);
+    }
+
+    @Test
+    public void testSetNClobIntegerReader() throws Exception {
+        try {
+            delegate.setNClob(1,(java.io.StringReader) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setNClob(1,(java.io.StringReader) null);
+    }
+
+    @Test
+    public void testSetNClobIntegerReaderLong() throws Exception {
+        try {
+            delegate.setNClob(1,(java.io.StringReader) null,1l);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setNClob(1,(java.io.StringReader) null,1l);
+    }
+
+    @Test
+    public void testSetNStringIntegerString() throws Exception {
+        try {
+            delegate.setNString(1,"foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setNString(1,"foo");
+    }
+
+    @Test
+    public void testSetNullIntegerIntegerString() throws Exception {
+        try {
+            delegate.setNull(1,1,"foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setNull(1,1,"foo");
+    }
+
+    @Test
+    public void testSetNullIntegerInteger() throws Exception {
+        try {
+            delegate.setNull(1,1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setNull(1,1);
+    }
+
+    @Test
+    public void testSetObjectIntegerObjectSQLType() throws Exception {
+        try {
+            delegate.setObject(1,System.err,(java.sql.SQLType) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setObject(1,System.err,(java.sql.SQLType) null);
+    }
+
+    @Test
+    public void testSetObjectIntegerObjectSQLTypeInteger() throws Exception {
+        try {
+            delegate.setObject(1,System.err,(java.sql.SQLType) null,1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setObject(1,System.err,(java.sql.SQLType) null,1);
+    }
+
+    @Test
+    public void testSetObjectIntegerObjectIntegerInteger() throws Exception {
+        try {
+            delegate.setObject(1,System.err,1,1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setObject(1,System.err,1,1);
+    }
+
+    @Test
+    public void testSetObjectIntegerObjectInteger() throws Exception {
+        try {
+            delegate.setObject(1,System.err,1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setObject(1,System.err,1);
+    }
+
+    @Test
+    public void testSetObjectIntegerObject() throws Exception {
+        try {
+            delegate.setObject(1,System.err);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setObject(1,System.err);
+    }
+
+    @Test
+    public void testSetRefIntegerRef() throws Exception {
+        try {
+            delegate.setRef(1,(java.sql.Ref) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setRef(1,(java.sql.Ref) null);
+    }
+
+    @Test
+    public void testSetRowIdIntegerRowId() throws Exception {
+        try {
+            delegate.setRowId(1,(java.sql.RowId) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setRowId(1,(java.sql.RowId) null);
+    }
+
+    @Test
+    public void testSetSQLXMLIntegerSQLXML() throws Exception {
+        try {
+            delegate.setSQLXML(1,(java.sql.SQLXML) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setSQLXML(1,(java.sql.SQLXML) null);
+    }
+
+    @Test
+    public void testSetShortIntegerShort() throws Exception {
+        try {
+            delegate.setShort(1,(short) 1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setShort(1,(short) 1);
+    }
+
+    @Test
+    public void testSetStringIntegerString() throws Exception {
+        try {
+            delegate.setString(1,"foo");
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setString(1,"foo");
+    }
+
+    @Test
+    public void testSetTimeIntegerTime() throws Exception {
+        try {
+            delegate.setTime(1,(java.sql.Time) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setTime(1,(java.sql.Time) null);
+    }
+
+    @Test
+    public void testSetTimeIntegerTimeCalendar() throws Exception {
+        try {
+            delegate.setTime(1,(java.sql.Time) null,(java.util.Calendar) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setTime(1,(java.sql.Time) null,(java.util.Calendar) null);
+    }
+
+    @Test
+    public void testSetTimestampIntegerTimestamp() throws Exception {
+        try {
+            delegate.setTimestamp(1,(java.sql.Timestamp) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setTimestamp(1,(java.sql.Timestamp) null);
+    }
+
+    @Test
+    public void testSetTimestampIntegerTimestampCalendar() throws Exception {
+        try {
+            delegate.setTimestamp(1,(java.sql.Timestamp) null,(java.util.Calendar) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setTimestamp(1,(java.sql.Timestamp) null,(java.util.Calendar) null);
+    }
+
+    @Test
+    public void testSetURLIntegerUrl() throws Exception {
+        try {
+            delegate.setURL(1,(java.net.URL) null);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setURL(1,(java.net.URL) null);
+    }
+
+    @Test
+    public void testSetUnicodeStreamIntegerInputStreamInteger() throws Exception {
+        try {
+            delegate.setUnicodeStream(1,(java.io.InputStream) null,1);
+        } catch (SQLException e) {}
+        verify(obj, times(1)).setUnicodeStream(1,(java.io.InputStream) null,1);
+    }
+
 }