commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwaldh...@apache.org
Subject cvs commit: jakarta-commons/pool/src/test/org/apache/commons/pool TestObjectPool.java
Date Thu, 24 Apr 2003 01:33:11 GMT
rwaldhoff    2003/04/23 18:33:11

  Modified:    pool/src/test/org/apache/commons/pool TestObjectPool.java
  Log:
  add tests for ObjectPool.addObject()
  rename TestObjectPool tests to keep them different from the child TestCase method names
  
  Revision  Changes    Path
  1.4       +35 -11    jakarta-commons/pool/src/test/org/apache/commons/pool/TestObjectPool.java
  
  Index: TestObjectPool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/pool/src/test/org/apache/commons/pool/TestObjectPool.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestObjectPool.java	7 Mar 2003 15:18:21 -0000	1.3
  +++ TestObjectPool.java	24 Apr 2003 01:33:11 -0000	1.4
  @@ -94,7 +94,7 @@
           _pool = null;
       }
       
  -    public void testBorrow() throws Exception {
  +    public void testBaseBorrow() throws Exception {
           try {
               _pool = makeEmptyPool(3);
           } catch(IllegalArgumentException e) {
  @@ -105,7 +105,31 @@
           assertEquals(getNthObject(2),_pool.borrowObject());
       }
   
  -    public void testBorrowReturn() throws Exception {
  +    public void testBaseAddObject() throws Exception {
  +        try {
  +            _pool = makeEmptyPool(3);
  +        } catch(IllegalArgumentException e) {
  +            return; // skip this test if unsupported
  +        }
  +        try {
  +            assertEquals(0,_pool.getNumIdle());
  +            assertEquals(0,_pool.getNumActive());
  +            _pool.addObject();
  +            assertEquals(1,_pool.getNumIdle());
  +            assertEquals(0,_pool.getNumActive());
  +            Object obj = _pool.borrowObject();
  +            assertEquals(getNthObject(0),obj);
  +            assertEquals(0,_pool.getNumIdle());
  +            assertEquals(1,_pool.getNumActive());
  +            _pool.returnObject(obj);
  +            assertEquals(1,_pool.getNumIdle());
  +            assertEquals(0,_pool.getNumActive());
  +        } catch(UnsupportedOperationException e) {
  +            return; // skip this test if one of those calls is unsupported
  +        }
  +    }
  +    
  +    public void testBaseBorrowReturn() throws Exception {
           try {
               _pool = makeEmptyPool(3);
           } catch(IllegalArgumentException e) {
  @@ -131,7 +155,7 @@
           assertEquals(getNthObject(0),obj0);
       }
   
  -    public void testNumActiveNumIdle() throws Exception {
  +    public void testBaseNumActiveNumIdle() throws Exception {
           try {
               _pool = makeEmptyPool(3);
           } catch(IllegalArgumentException e) {
  @@ -153,7 +177,7 @@
           assertEquals(2,_pool.getNumIdle());
       }
   
  -    public void testClear() throws Exception {
  +    public void testBaseClear() throws Exception {
           try {
               _pool = makeEmptyPool(3);
           } catch(IllegalArgumentException e) {
  @@ -176,7 +200,7 @@
           assertEquals(getNthObject(2),obj2);
       }
   
  -    public void testInvalidateObject() throws Exception {
  +    public void testBaseInvalidateObject() throws Exception {
           try {
               _pool = makeEmptyPool(3);
           } catch(IllegalArgumentException e) {
  @@ -196,7 +220,7 @@
           assertEquals(0,_pool.getNumIdle());
       }
       
  -    public void testClosePool() throws Exception {
  +    public void testBaseClosePool() throws Exception {
           try {
               _pool = makeEmptyPool(3);
           } catch(IllegalArgumentException e) {
  @@ -214,7 +238,7 @@
           }
       }
   
  -    public void testCantCloseTwice() throws Exception {
  +    public void testBaseCantCloseTwice() throws Exception {
           try {
               _pool = makeEmptyPool(3);
           } catch(IllegalArgumentException e) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message