The following change to the GKOP ctor seems to fix the problem:
if (factory == null) { this.close(); // <============= close the parent throw new IllegalArgumentException("factory may not be null"); } Not 100% sure if that is the correct fix - perhaps tearDown() needs to be adjusted? On 4 May 2012 19:02, <s...@apache.org> wrote: > Author: sebb > Date: Fri May 4 18:02:27 2012 > New Revision: 1334103 > > URL: http://svn.apache.org/viewvc?rev=1334103&view=rev > Log: > Add specific test for null factory > TODO causes tearDown error > > Modified: > > commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java > > Modified: > commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java > URL: > http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java?rev=1334103&r1=1334102&r2=1334103&view=diff > ============================================================================== > --- > commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java > (original) > +++ > commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java > Fri May 4 18:02:27 2012 > @@ -1111,6 +1111,14 @@ public class TestGenericKeyedObjectPool > pool.close(); > } > > + @Test(expected=IllegalArgumentException.class) > + public void testConstructorNullFactory() { > + // add dummy assert (won't be invoked because of IAE) to avoid > "unused" warning > + assertNotNull(new GenericKeyedObjectPool<String,String>(null)); > + // TODO this currently causes tearDown to report an error > + // Looks like GKOP needs to call close() on its parent before > throwing IAE > + } > + > @Test(timeout=60000) > public void testExceptionOnPassivateDuringReturn() throws Exception { > SimpleFactory<String> factory = new SimpleFactory<String>(); > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org