commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1021913 - /commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java
Date Tue, 12 Oct 2010 20:23:02 GMT
Author: simonetripodi
Date: Tue Oct 12 20:23:02 2010
New Revision: 1021913

URL: http://svn.apache.org/viewvc?rev=1021913&view=rev
Log:
removed test that explicitly required a null factory
fixed broken tests

Modified:
    commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java?rev=1021913&r1=1021912&r2=1021913&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java
Tue Oct 12 20:23:02 2010
@@ -20,6 +20,7 @@ package org.apache.commons.pool.impl;
 import java.util.BitSet;
 import java.util.HashMap;
 import java.util.NoSuchElementException;
+import java.util.Random;
 
 import org.apache.commons.pool.KeyedObjectPool;
 import org.apache.commons.pool.KeyedPoolableObjectFactory;
@@ -135,41 +136,17 @@ public class TestStackKeyedObjectPool ex
         assertEquals("3", pool.borrowObject("")); // New instance created (0 is gone)
     }
 
-    public void testPoolWithNullFactory() throws Exception {
-        KeyedObjectPool<String,Integer> pool = new StackKeyedObjectPool<String,Integer>(10);
-        for(int i=0;i<10;i++) {
-            pool.returnObject("X",new Integer(i));
-        }
-        for(int j=0;j<3;j++) {
-            Integer[] borrowed = new Integer[10];
-            BitSet found = new BitSet();
-            for(int i=0;i<10;i++) {
-                borrowed[i] = (pool.borrowObject("X"));
-                assertNotNull(borrowed);
-                assertTrue(!found.get(borrowed[i].intValue()));
-                found.set(borrowed[i].intValue());
-            }
-            for(int i=0;i<10;i++) {
-                pool.returnObject("X",borrowed[i]);
-            }
-        }
-        pool.invalidateObject("X",pool.borrowObject("X"));
-        pool.invalidateObject("X",pool.borrowObject("X"));
-        pool.clear("X");
-        pool.clear();
-    }
-
     public void testVariousConstructors() throws Exception {
         {
-            StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(null);
+            StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(new
SimpleFactory());
             assertNotNull(pool);
         }
         {
-            StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(null,10);
+            StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(new
SimpleFactory(),10);
             assertNotNull(pool);
         }
         {
-            StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(null,10,5);
+            StackKeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(new
SimpleFactory(),10,5);
             assertNotNull(pool);
         }
     }
@@ -184,16 +161,6 @@ public class TestStackKeyedObjectPool ex
         assertNotNull(pool.toString());
     }
 
-    public void testBorrowFromEmptyPoolWithNullFactory() throws Exception {
-        KeyedObjectPool<String,Object> pool = new StackKeyedObjectPool<String,Object>();
-        try {
-            pool.borrowObject("x");
-            fail("Expected NoSuchElementException");
-        } catch(NoSuchElementException e) {
-            // expected
-        }
-    }
-
     public void testBorrowReturnWithSometimesInvalidObjects() throws Exception {
         KeyedObjectPool<Object,Object> pool = new StackKeyedObjectPool<Object,Object>(
             new KeyedPoolableObjectFactory<Object,Object>() {



Mime
View raw message