[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/release Commit: 64a13ee391894a1aa8b9c0d40d91783d5804377d Parents: 6290403 Author: Bruno P. Kinoshita <ki...@apache.org> Authored: Tue Jul 3 19:56:06 2018 -0400 Committer: Gary Gregory <garydgreg...@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