assertEquals(0, pool.getNumActive());
assertEquals(3, pool.getNumIdle());
// Should ignore the first invalid element and return the second valid
// session.
Session session = (Session) pool.borrowObject();
// Can't check the number of idle Sessions at this point, because the
// objects in the set could be returned in any order.
assertEquals(1, pool.getNumActive());
// There was only one valid session in the pool, so when a second one
// is requested this should guarantee that the invalid ones are removed
// and a new one is created (because we still have room).
Session sessionTwo = (Session) pool.borrowObject();
assertNotEquals(invalidObject, sessionTwo);
assertNotEquals(invalidObjectTwo, sessionTwo);
assertNotEquals(session, sessionTwo);
assertEquals(2, pool.getNumActive());
assertEquals(0, pool.getNumIdle());