This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-dbcp.git
The following commit(s) were added to refs/heads/master by this push: new a7d81169 Fix formatting a7d81169 is described below commit a7d81169896c85df84c26b0007bebf1643890e5d Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat Jul 8 09:26:53 2023 -0400 Fix formatting --- doc/PoolingDataSourceExample.java | 2 +- doc/PoolingDriverExample.java | 4 +- .../apache/commons/dbcp2/TestConnectionPool.java | 2 +- .../dbcp2/TestDelegatingCallableStatement.java | 6 +- .../commons/dbcp2/TestDelegatingConnection.java | 2 +- .../dbcp2/TestDelegatingPreparedStatement.java | 390 ++++++++++++--------- .../commons/dbcp2/TestDelegatingStatement.java | 2 +- .../apache/commons/dbcp2/TestPoolingDriver.java | 6 +- 8 files changed, 236 insertions(+), 178 deletions(-) diff --git a/doc/PoolingDataSourceExample.java b/doc/PoolingDataSourceExample.java index 13227129..ab451875 100644 --- a/doc/PoolingDataSourceExample.java +++ b/doc/PoolingDataSourceExample.java @@ -150,7 +150,7 @@ public class PoolingDataSourceExample { // arguments. // ConnectionFactory connectionFactory = - new DriverManagerConnectionFactory(connectURI,null); + new DriverManagerConnectionFactory(connectURI, null); // // Next we'll create the PoolableConnectionFactory, which wraps diff --git a/doc/PoolingDriverExample.java b/doc/PoolingDriverExample.java index cc96d775..b1123094 100644 --- a/doc/PoolingDriverExample.java +++ b/doc/PoolingDriverExample.java @@ -165,7 +165,7 @@ public class PoolingDriverExample { // arguments. // ConnectionFactory connectionFactory = - new DriverManagerConnectionFactory(connectURI,null); + new DriverManagerConnectionFactory(connectURI, null); // // Next, we'll create the PoolableConnectionFactory, which wraps @@ -197,7 +197,7 @@ public class PoolingDriverExample { // // ...and register our pool with it. // - driver.registerPool("example",connectionPool); + driver.registerPool("example", connectionPool); // // Now we can just use the connect string "jdbc:apache:commons:dbcp:example" diff --git a/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java b/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java index 76201f17..f58ce259 100644 --- a/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java +++ b/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java @@ -239,7 +239,7 @@ public abstract class TestConnectionPool { assertFalse(conn.isClosed()); assertFalse(isClosed(statement)); - assertSame(conn,statement.getConnection(), + assertSame(conn, statement.getConnection(), "statement.getConnection() should return the exact same connection instance that was used to create the statement"); final ResultSet resultSet = statement.getResultSet(); diff --git a/src/test/java/org/apache/commons/dbcp2/TestDelegatingCallableStatement.java b/src/test/java/org/apache/commons/dbcp2/TestDelegatingCallableStatement.java index 0c1dcb87..54c7ef6c 100644 --- a/src/test/java/org/apache/commons/dbcp2/TestDelegatingCallableStatement.java +++ b/src/test/java/org/apache/commons/dbcp2/TestDelegatingCallableStatement.java @@ -49,14 +49,14 @@ public class TestDelegatingCallableStatement { @Test public void testExecuteQueryReturnsNotNull() throws Exception { final TesterCallableStatement delegateStmt = new TesterCallableStatement(conn,"select * from foo"); - obj = new DelegatingCallableStatement(new DelegatingConnection<Connection>(conn),delegateStmt); + obj = new DelegatingCallableStatement(new DelegatingConnection<Connection>(conn), delegateStmt); assertNotNull(obj.executeQuery()); } @Test public void testExecuteQueryReturnsNull() throws Exception { final TesterCallableStatement delegateStmt = new TesterCallableStatement(conn,"null"); - obj = new DelegatingCallableStatement(new DelegatingConnection<Connection>(conn),delegateStmt); + obj = new DelegatingCallableStatement(new DelegatingConnection<Connection>(conn), delegateStmt); assertNull(obj.executeQuery()); } @@ -252,7 +252,7 @@ public class TestDelegatingCallableStatement { @Test public void testGetDelegate() throws Exception { final TesterCallableStatement delegateStmt = new TesterCallableStatement(conn,"select * from foo"); - obj = new DelegatingCallableStatement(new DelegatingConnection<Connection>(conn),delegateStmt); + obj = new DelegatingCallableStatement(new DelegatingConnection<Connection>(conn), delegateStmt); assertEquals(delegateStmt,((DelegatingCallableStatement)obj).getDelegate()); } diff --git a/src/test/java/org/apache/commons/dbcp2/TestDelegatingConnection.java b/src/test/java/org/apache/commons/dbcp2/TestDelegatingConnection.java index 4ea627c8..3519b171 100644 --- a/src/test/java/org/apache/commons/dbcp2/TestDelegatingConnection.java +++ b/src/test/java/org/apache/commons/dbcp2/TestDelegatingConnection.java @@ -178,7 +178,7 @@ public class TestDelegatingConnection { @Test public void testGetDelegate() throws Exception { - assertEquals(connection,delegatingConnection.getDelegate()); + assertEquals(connection, delegatingConnection.getDelegate()); } @Test diff --git a/src/test/java/org/apache/commons/dbcp2/TestDelegatingPreparedStatement.java b/src/test/java/org/apache/commons/dbcp2/TestDelegatingPreparedStatement.java index 0bd4fa26..077178e5 100644 --- a/src/test/java/org/apache/commons/dbcp2/TestDelegatingPreparedStatement.java +++ b/src/test/java/org/apache/commons/dbcp2/TestDelegatingPreparedStatement.java @@ -42,7 +42,7 @@ public class TestDelegatingPreparedStatement { public void setUp() throws Exception { testerConn = new TesterConnection("test", "test"); connection = new DelegatingConnection<>(testerConn); - obj = mock(PreparedStatement.class); + obj = mock(PreparedStatement.class); delegate = new DelegatingPreparedStatement(connection, obj); } @@ -50,7 +50,8 @@ public class TestDelegatingPreparedStatement { public void testAddBatch() throws Exception { try { delegate.addBatch(); - } catch (final SQLException e) {} + } catch (final SQLException e) { + } verify(obj, times(1)).addBatch(); } @@ -58,7 +59,8 @@ public class TestDelegatingPreparedStatement { public void testClearParameters() throws Exception { try { delegate.clearParameters(); - } catch (final SQLException e) {} + } catch (final SQLException e) { + } verify(obj, times(1)).clearParameters(); } @@ -66,7 +68,8 @@ public class TestDelegatingPreparedStatement { public void testExecute() throws Exception { try { delegate.execute(); - } catch (final SQLException e) {} + } catch (final SQLException e) { + } verify(obj, times(1)).execute(); } @@ -74,7 +77,8 @@ public class TestDelegatingPreparedStatement { public void testExecuteLargeUpdate() throws Exception { try { delegate.executeLargeUpdate(); - } catch (final SQLException e) {} + } catch (final SQLException e) { + } verify(obj, times(1)).executeLargeUpdate(); } @@ -82,21 +86,22 @@ public class TestDelegatingPreparedStatement { public void testExecuteQuery() throws Exception { try { delegate.executeQuery(); - } catch (final SQLException e) {} + } catch (final SQLException e) { + } verify(obj, times(1)).executeQuery(); } @Test public void testExecuteQueryReturnsNotNull() throws Exception { - obj = new TesterPreparedStatement(testerConn,"select * from foo"); - delegate = new DelegatingPreparedStatement(connection,obj); + obj = new TesterPreparedStatement(testerConn, "select * from foo"); + delegate = new DelegatingPreparedStatement(connection, obj); assertNotNull(delegate.executeQuery()); } @Test public void testExecuteQueryReturnsNull() throws Exception { - obj = new TesterPreparedStatement(testerConn,"null"); - delegate = new DelegatingPreparedStatement(connection,obj); + obj = new TesterPreparedStatement(testerConn, "null"); + delegate = new DelegatingPreparedStatement(connection, obj); assertNull(delegate.executeQuery()); } @@ -104,22 +109,24 @@ public class TestDelegatingPreparedStatement { public void testExecuteUpdate() throws Exception { try { delegate.executeUpdate(); - } catch (final SQLException e) {} + } catch (final SQLException e) { + } verify(obj, times(1)).executeUpdate(); } @Test public void testGetDelegate() throws Exception { - obj = new TesterPreparedStatement(testerConn,"select * from foo"); - delegate = new DelegatingPreparedStatement(connection,obj); - assertEquals(obj,delegate.getDelegate()); + obj = new TesterPreparedStatement(testerConn, "select * from foo"); + delegate = new DelegatingPreparedStatement(connection, obj); + assertEquals(obj, delegate.getDelegate()); } @Test public void testGetMetaData() throws Exception { try { delegate.getMetaData(); - } catch (final SQLException e) {} + } catch (final SQLException e) { + } verify(obj, times(1)).getMetaData(); } @@ -127,408 +134,459 @@ public class TestDelegatingPreparedStatement { public void testGetParameterMetaData() throws Exception { try { delegate.getParameterMetaData(); - } catch (final SQLException e) {} + } catch (final SQLException e) { + } verify(obj, times(1)).getParameterMetaData(); } @Test public void testSetArrayIntegerArray() throws Exception { try { - delegate.setArray(1,(java.sql.Array) null); - } catch (final SQLException e) {} - verify(obj, times(1)).setArray(1,(java.sql.Array) null); + delegate.setArray(1, (java.sql.Array) null); + } catch (final SQLException e) { + } + verify(obj, times(1)).setArray(1, (java.sql.Array) null); } @Test public void testSetAsciiStreamIntegerInputStream() throws Exception { try { - delegate.setAsciiStream(1,(java.io.InputStream) null); - } catch (final SQLException e) {} - verify(obj, times(1)).setAsciiStream(1,(java.io.InputStream) null); + delegate.setAsciiStream(1, (java.io.InputStream) null); + } catch (final SQLException e) { + } + verify(obj, times(1)).setAsciiStream(1, (java.io.InputStream) null); } @Test public void testSetAsciiStreamIntegerInputStreamInteger() throws Exception { try { - delegate.setAsciiStream(1,(java.io.InputStream) null,1); - } catch (final SQLException e) {} - verify(obj, times(1)).setAsciiStream(1,(java.io.InputStream) null,1); + delegate.setAsciiStream(1, (java.io.InputStream) null, 1); + } catch (final SQLException e) { + } + verify(obj, times(1)).setAsciiStream(1, (java.io.InputStream) null, 1); } @Test public void testSetAsciiStreamIntegerInputStreamLong() throws Exception { try { - delegate.setAsciiStream(1,(java.io.InputStream) null,1L); - } catch (final SQLException e) {} - verify(obj, times(1)).setAsciiStream(1,(java.io.InputStream) null,1L); + delegate.setAsciiStream(1, (java.io.InputStream) null, 1L); + } catch (final SQLException e) { + } + verify(obj, times(1)).setAsciiStream(1, (java.io.InputStream) null, 1L); } @Test public void testSetBigDecimalIntegerBigDecimal() throws Exception { try { - delegate.setBigDecimal(1,java.math.BigDecimal.valueOf(1.0d)); - } catch (final SQLException e) {} - verify(obj, times(1)).setBigDecimal(1,java.math.BigDecimal.valueOf(1.0d)); + delegate.setBigDecimal(1, java.math.BigDecimal.valueOf(1.0d)); + } catch (final SQLException e) { + } + verify(obj, times(1)).setBigDecimal(1, java.math.BigDecimal.valueOf(1.0d)); } @Test public void testSetBinaryStreamIntegerInputStream() throws Exception { try { - delegate.setBinaryStream(1,(java.io.InputStream) null); - } catch (final SQLException e) {} - verify(obj, times(1)).setBinaryStream(1,(java.io.InputStream) null); + delegate.setBinaryStream(1, (java.io.InputStream) null); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setBinaryStream(1,(java.io.InputStream) null,1); + delegate.setBinaryStream(1, (java.io.InputStream) null, 1); + } catch (final SQLException e) { + } + verify(obj, times(1)).setBinaryStream(1, (java.io.InputStream) null, 1); } @Test public void testSetBinaryStreamIntegerInputStreamLong() throws Exception { try { - delegate.setBinaryStream(1,(java.io.InputStream) null,1L); - } catch (final SQLException e) {} - verify(obj, times(1)).setBinaryStream(1,(java.io.InputStream) null,1L); + delegate.setBinaryStream(1, (java.io.InputStream) null, 1L); + } catch (final SQLException e) { + } + verify(obj, times(1)).setBinaryStream(1, (java.io.InputStream) null, 1L); } @Test public void testSetBlobIntegerBlob() throws Exception { try { - delegate.setBlob(1,(java.sql.Blob) null); - } catch (final SQLException e) {} - verify(obj, times(1)).setBlob(1,(java.sql.Blob) null); + delegate.setBlob(1, (java.sql.Blob) null); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setBlob(1,(java.io.InputStream) null); + delegate.setBlob(1, (java.io.InputStream) null); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setBlob(1,(java.io.InputStream) null,1L); + delegate.setBlob(1, (java.io.InputStream) null, 1L); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setBoolean(1,Boolean.TRUE); + delegate.setBoolean(1, Boolean.TRUE); + } catch (final SQLException e) { + } + verify(obj, times(1)).setBoolean(1, Boolean.TRUE); } @Test public void testSetByteIntegerByte() throws Exception { try { - delegate.setByte(1,(byte) 1); - } catch (final SQLException e) {} - verify(obj, times(1)).setByte(1,(byte) 1); + delegate.setByte(1, (byte) 1); + } catch (final SQLException e) { + } + verify(obj, times(1)).setByte(1, (byte) 1); } @Test public void testSetBytesIntegerByteArray() throws Exception { try { - delegate.setBytes(1,new byte[] { 1 }); - } catch (final SQLException e) {} - verify(obj, times(1)).setBytes(1,new byte[] { 1 }); + delegate.setBytes(1, new byte[] { 1 }); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setCharacterStream(1,(java.io.StringReader) null); + delegate.setCharacterStream(1, (java.io.StringReader) null); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setCharacterStream(1,(java.io.StringReader) null,1); + delegate.setCharacterStream(1, (java.io.StringReader) null, 1); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setCharacterStream(1,(java.io.StringReader) null,1L); + delegate.setCharacterStream(1, (java.io.StringReader) null, 1L); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setClob(1,(java.sql.Clob) null); + delegate.setClob(1, (java.sql.Clob) null); + } catch (final SQLException e) { + } + verify(obj, times(1)).setClob(1, (java.sql.Clob) null); } @Test public void testSetClobIntegerReader() throws Exception { try { - delegate.setClob(1,(java.io.StringReader) null); - } catch (final SQLException e) {} - verify(obj, times(1)).setClob(1,(java.io.StringReader) null); + delegate.setClob(1, (java.io.StringReader) null); + } catch (final SQLException e) { + } + verify(obj, times(1)).setClob(1, (java.io.StringReader) null); } @Test public void testSetClobIntegerReaderLong() throws Exception { try { - delegate.setClob(1,(java.io.StringReader) null,1L); - } catch (final SQLException e) {} - verify(obj, times(1)).setClob(1,(java.io.StringReader) null,1L); + delegate.setClob(1, (java.io.StringReader) null, 1L); + } catch (final SQLException e) { + } + verify(obj, times(1)).setClob(1, (java.io.StringReader) null, 1L); } @Test public void testSetDateIntegerSqlDate() throws Exception { try { - delegate.setDate(1,new java.sql.Date(1529827548745L)); - } catch (final SQLException e) {} - verify(obj, times(1)).setDate(1,new java.sql.Date(1529827548745L)); + delegate.setDate(1, new java.sql.Date(1529827548745L)); + } catch (final SQLException e) { + } + verify(obj, times(1)).setDate(1, new java.sql.Date(1529827548745L)); } @Test public void testSetDateIntegerSqlDateCalendar() throws Exception { try { - delegate.setDate(1,new java.sql.Date(1529827548745L),(java.util.Calendar) null); - } catch (final SQLException e) {} - verify(obj, times(1)).setDate(1,new java.sql.Date(1529827548745L),(java.util.Calendar) null); + delegate.setDate(1, new java.sql.Date(1529827548745L), (java.util.Calendar) null); + } catch (final SQLException e) { + } + verify(obj, times(1)).setDate(1, new java.sql.Date(1529827548745L), (java.util.Calendar) null); } @Test public void testSetDoubleIntegerDouble() throws Exception { try { - delegate.setDouble(1,1.0d); - } catch (final SQLException e) {} - verify(obj, times(1)).setDouble(1,1.0d); + delegate.setDouble(1, 1.0d); + } catch (final SQLException e) { + } + verify(obj, times(1)).setDouble(1, 1.0d); } @Test public void testSetFloatIntegerFloat() throws Exception { try { - delegate.setFloat(1,1.0f); - } catch (final SQLException e) {} - verify(obj, times(1)).setFloat(1,1.0f); + delegate.setFloat(1, 1.0f); + } catch (final SQLException e) { + } + verify(obj, times(1)).setFloat(1, 1.0f); } @Test public void testSetIntIntegerInteger() throws Exception { try { - delegate.setInt(1,1); - } catch (final SQLException e) {} - verify(obj, times(1)).setInt(1,1); + delegate.setInt(1, 1); + } catch (final SQLException e) { + } + verify(obj, times(1)).setInt(1, 1); } @Test public void testSetLongIntegerLong() throws Exception { try { - delegate.setLong(1,1L); - } catch (final SQLException e) {} - verify(obj, times(1)).setLong(1,1L); + delegate.setLong(1, 1L); + } catch (final SQLException e) { + } + verify(obj, times(1)).setLong(1, 1L); } @Test public void testSetNCharacterStreamIntegerReader() throws Exception { try { - delegate.setNCharacterStream(1,(java.io.StringReader) null); - } catch (final SQLException e) {} - verify(obj, times(1)).setNCharacterStream(1,(java.io.StringReader) null); + delegate.setNCharacterStream(1, (java.io.StringReader) null); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setNCharacterStream(1,(java.io.StringReader) null,1L); + delegate.setNCharacterStream(1, (java.io.StringReader) null, 1L); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setNClob(1,(java.sql.NClob) null); + delegate.setNClob(1, (java.sql.NClob) null); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setNClob(1,(java.io.StringReader) null); + delegate.setNClob(1, (java.io.StringReader) null); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setNClob(1,(java.io.StringReader) null,1L); + delegate.setNClob(1, (java.io.StringReader) null, 1L); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setNString(1,"foo"); + delegate.setNString(1, "foo"); + } catch (final SQLException e) { + } + verify(obj, times(1)).setNString(1, "foo"); } @Test public void testSetNullIntegerInteger() throws Exception { try { - delegate.setNull(1,1); - } catch (final SQLException e) {} - verify(obj, times(1)).setNull(1,1); + delegate.setNull(1, 1); + } catch (final SQLException e) { + } + verify(obj, times(1)).setNull(1, 1); } @Test public void testSetNullIntegerIntegerString() throws Exception { try { - delegate.setNull(1,1,"foo"); - } catch (final SQLException e) {} - verify(obj, times(1)).setNull(1,1,"foo"); + delegate.setNull(1, 1, "foo"); + } catch (final SQLException e) { + } + verify(obj, times(1)).setNull(1, 1, "foo"); } @Test public void testSetObjectIntegerObject() throws Exception { try { - delegate.setObject(1,System.err); - } catch (final SQLException e) {} - verify(obj, times(1)).setObject(1,System.err); + delegate.setObject(1, System.err); + } catch (final SQLException e) { + } + verify(obj, times(1)).setObject(1, System.err); } @Test public void testSetObjectIntegerObjectInteger() throws Exception { try { - delegate.setObject(1,System.err,1); - } catch (final SQLException e) {} - verify(obj, times(1)).setObject(1,System.err,1); + delegate.setObject(1, System.err, 1); + } catch (final SQLException e) { + } + verify(obj, times(1)).setObject(1, System.err, 1); } @Test public void testSetObjectIntegerObjectIntegerInteger() throws Exception { try { - delegate.setObject(1,System.err,1,1); - } catch (final SQLException e) {} - verify(obj, times(1)).setObject(1,System.err,1,1); + delegate.setObject(1, System.err, 1, 1); + } catch (final SQLException e) { + } + verify(obj, times(1)).setObject(1, System.err, 1, 1); } @Test public void testSetObjectIntegerObjectSQLType() throws Exception { try { - delegate.setObject(1,System.err,(java.sql.SQLType) null); - } catch (final SQLException e) {} - verify(obj, times(1)).setObject(1,System.err,(java.sql.SQLType) null); + delegate.setObject(1, System.err, (java.sql.SQLType) null); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setObject(1,System.err,(java.sql.SQLType) null,1); + delegate.setObject(1, System.err, (java.sql.SQLType) null, 1); + } catch (final SQLException e) { + } + verify(obj, times(1)).setObject(1, System.err, (java.sql.SQLType) null, 1); } @Test public void testSetRefIntegerRef() throws Exception { try { - delegate.setRef(1,(java.sql.Ref) null); - } catch (final SQLException e) {} - verify(obj, times(1)).setRef(1,(java.sql.Ref) null); + delegate.setRef(1, (java.sql.Ref) null); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setRowId(1,(java.sql.RowId) null); + delegate.setRowId(1, (java.sql.RowId) null); + } catch (final SQLException e) { + } + verify(obj, times(1)).setRowId(1, (java.sql.RowId) null); } @Test public void testSetShortIntegerShort() throws Exception { try { - delegate.setShort(1,(short) 1); - } catch (final SQLException e) {} - verify(obj, times(1)).setShort(1,(short) 1); + delegate.setShort(1, (short) 1); + } catch (final SQLException e) { + } + verify(obj, times(1)).setShort(1, (short) 1); } @Test public void testSetSQLXMLIntegerSQLXML() throws Exception { try { - delegate.setSQLXML(1,(java.sql.SQLXML) null); - } catch (final SQLException e) {} - verify(obj, times(1)).setSQLXML(1,(java.sql.SQLXML) null); + delegate.setSQLXML(1, (java.sql.SQLXML) null); + } catch (final SQLException e) { + } + verify(obj, times(1)).setSQLXML(1, (java.sql.SQLXML) null); } @Test public void testSetStringIntegerString() throws Exception { try { - delegate.setString(1,"foo"); - } catch (final SQLException e) {} - verify(obj, times(1)).setString(1,"foo"); + delegate.setString(1, "foo"); + } catch (final SQLException e) { + } + verify(obj, times(1)).setString(1, "foo"); } @Test public void testSetTimeIntegerTime() throws Exception { try { - delegate.setTime(1,(java.sql.Time) null); - } catch (final SQLException e) {} - verify(obj, times(1)).setTime(1,(java.sql.Time) null); + delegate.setTime(1, (java.sql.Time) null); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setTime(1,(java.sql.Time) null,(java.util.Calendar) null); + delegate.setTime(1, (java.sql.Time) null, (java.util.Calendar) null); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setTimestamp(1,(java.sql.Timestamp) null); + delegate.setTimestamp(1, (java.sql.Timestamp) null); + } catch (final 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 (final SQLException e) {} - verify(obj, times(1)).setTimestamp(1,(java.sql.Timestamp) null,(java.util.Calendar) null); + delegate.setTimestamp(1, (java.sql.Timestamp) null, (java.util.Calendar) null); + } catch (final SQLException e) { + } + verify(obj, times(1)).setTimestamp(1, (java.sql.Timestamp) null, (java.util.Calendar) null); } @Test public void testSetUnicodeStreamIntegerInputStreamInteger() throws Exception { try { - delegate.setUnicodeStream(1,(java.io.InputStream) null,1); - } catch (final SQLException e) {} - verify(obj, times(1)).setUnicodeStream(1,(java.io.InputStream) null,1); + delegate.setUnicodeStream(1, (java.io.InputStream) null, 1); + } catch (final SQLException e) { + } + verify(obj, times(1)).setUnicodeStream(1, (java.io.InputStream) null, 1); } @Test public void testSetURLIntegerUrl() throws Exception { try { - delegate.setURL(1,(java.net.URL) null); - } catch (final SQLException e) {} - verify(obj, times(1)).setURL(1,(java.net.URL) null); + delegate.setURL(1, (java.net.URL) null); + } catch (final SQLException e) { + } + verify(obj, times(1)).setURL(1, (java.net.URL) null); } } diff --git a/src/test/java/org/apache/commons/dbcp2/TestDelegatingStatement.java b/src/test/java/org/apache/commons/dbcp2/TestDelegatingStatement.java index 3d0dd703..2906205d 100644 --- a/src/test/java/org/apache/commons/dbcp2/TestDelegatingStatement.java +++ b/src/test/java/org/apache/commons/dbcp2/TestDelegatingStatement.java @@ -319,7 +319,7 @@ public class TestDelegatingStatement { @Test public void testGetDelegate() throws Exception { - assertEquals(mockedStatement,delegatingStatement.getDelegate()); + assertEquals(mockedStatement, delegatingStatement.getDelegate()); } @Test diff --git a/src/test/java/org/apache/commons/dbcp2/TestPoolingDriver.java b/src/test/java/org/apache/commons/dbcp2/TestPoolingDriver.java index 6cb697d0..b0f86d92 100644 --- a/src/test/java/org/apache/commons/dbcp2/TestPoolingDriver.java +++ b/src/test/java/org/apache/commons/dbcp2/TestPoolingDriver.java @@ -59,7 +59,7 @@ public class TestPoolingDriver extends TestConnectionPool { @BeforeEach public void setUp() throws Exception { - final DriverConnectionFactory cf = new DriverConnectionFactory(new TesterDriver(),"jdbc:apache:commons:testdriver",null); + final DriverConnectionFactory cf = new DriverConnectionFactory(new TesterDriver(),"jdbc:apache:commons:testdriver", null); final PoolableConnectionFactory pcf = new PoolableConnectionFactory(cf, null); pcf.setPoolStatements(true); @@ -117,7 +117,7 @@ public class TestPoolingDriver extends TestConnectionPool { pcf.setDefaultAutoCommit(Boolean.TRUE); final GenericObjectPool<PoolableConnection> connectionPool = new GenericObjectPool<>(pcf); final PoolingDriver driver2 = new PoolingDriver(); - driver2.registerPool("example",connectionPool); + driver2.registerPool("example", connectionPool); } @Test @@ -218,7 +218,7 @@ public class TestPoolingDriver extends TestConnectionPool { poolableConnectionFactory.setPool(connectionPool); assertNotNull(poolableConnectionFactory); final PoolingDriver driver2 = new PoolingDriver(); - driver2.registerPool("neusoftim",connectionPool); + driver2.registerPool("neusoftim", connectionPool); final Connection[] conn = new Connection[25]; for(int i=0;i<25;i++) { conn[i] = DriverManager.getConnection("jdbc:apache:commons:dbcp:neusoftim");