You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2013/07/24 23:27:14 UTC

svn commit: r1506728 - /commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestCPDSConnectionFactory.java

Author: markt
Date: Wed Jul 24 21:27:14 2013
New Revision: 1506728

URL: http://svn.apache.org/r1506728
Log:
Use generics

Modified:
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestCPDSConnectionFactory.java

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestCPDSConnectionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestCPDSConnectionFactory.java?rev=1506728&r1=1506727&r2=1506728&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestCPDSConnectionFactory.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/datasources/TestCPDSConnectionFactory.java Wed Jul 24 21:27:14 2013
@@ -89,18 +89,15 @@ public class TestCPDSConnectionFactory e
     public void testConnectionErrorCleanup() throws Exception {
         // Setup factory
         CPDSConnectionFactory factory =
-            new CPDSConnectionFactory(cpds, null, false, "username", "password");
-        GenericObjectPool pool = new GenericObjectPool(factory);
+                new CPDSConnectionFactory(cpds, null, false, "username", "password");
+        GenericObjectPool<PooledConnectionAndInfo> pool =
+                new GenericObjectPool<>(factory);
         factory.setPool(pool);
 
         // Checkout a pair of connections
-        PooledConnection pcon1 =
-            ((PooledConnectionAndInfo) pool.borrowObject())
-                .getPooledConnection();
+        PooledConnection pcon1 = pool.borrowObject().getPooledConnection();
         Connection con1 = pcon1.getConnection();
-        PooledConnection pcon2 =
-            ((PooledConnectionAndInfo) pool.borrowObject())
-                .getPooledConnection();
+        PooledConnection pcon2 = pool.borrowObject().getPooledConnection();
         assertEquals(2, pool.getNumActive());
         assertEquals(0, pool.getNumIdle());
 
@@ -121,9 +118,7 @@ public class TestCPDSConnectionFactory e
         assertEquals(0, pool.getNumIdle());
 
         // Ask for another connection
-        PooledConnection pcon3 =
-            ((PooledConnectionAndInfo) pool.borrowObject())
-                .getPooledConnection();
+        PooledConnection pcon3 = pool.borrowObject().getPooledConnection();
         assertTrue(!pcon3.equals(pcon1)); // better not get baddie back
         assertTrue(!pc.getListeners().contains(factory)); // verify cleanup
         assertEquals(2, pool.getNumActive());