I am using Apache's GenericObjectPool
to create the pool of objects of my class.
I have web application. Once my request is processed, I am putting the the object back to the pool without any issues. In the code i am keeping the object back to the pool in finally
block.
My question is, in my JUnit test cases also i am getting the object from the pool and using it. Do I really need to keep the object back to the pool after my test case execution is completed?
@Test
public void testMethod(){
try{
//some code after getting the object from the pool
}catch(Exception e){
}finally{
//call the logic to put the object back to the pool here
}
}
Does it really required to keep the objects back to the client in test cases as mentioned in the finally block above?