@Test
public void testRunCreateConnections() throws InterruptedException, SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException, SQLException{

	expect(mockLogger.isDebugEnabled()).andReturn(true).anyTimes();
	LinkedBlockingQueue<ConnectionHandle> fakeConnections = new LinkedBlockingQueue<ConnectionHandle>(100);
/		mockPartition.almostFullWait();
/		expectLastCall().anyTimes();
	expect(mockPartition.getMaxConnections()).andAnswer(new IAnswer<Integer>() {
		// @Override
		public Integer answer() throws Throwable {
			if (first) {
				first=false;
				return 4;
			} 
			Field field = testClass.getClass().getDeclaredField("signalled");
			field.setAccessible(true);
			field.setBoolean(testClass, true);
			return 4;
		}
	}).anyTimes();
	
	expect(mockPartition.getFreeConnections()).andReturn(fakeConnections).anyTimes();
	expect(mockPartition.getAcquireIncrement()).andReturn(1);
	
	
	expect(mockPartition.getUrl()).andReturn(CommonTestUtils.url).anyTimes();
	expect(mockPartition.getPassword()).andReturn(CommonTestUtils.password).anyTimes();
	expect(mockPartition.getUsername()).andReturn(CommonTestUtils.username).anyTimes();
	expect(mockPartition.getAvailableConnections()).andReturn(fakeConnections.size()).anyTimes();
	mockPartition.addFreeConnection((ConnectionHandle)anyObject());
	expectLastCall().once();
	expect(mockPool.obtainInternalConnection((ConnectionHandle)anyObject())).andReturn(EasyMock.createNiceMock(Connection.class)).anyTimes();
	expect(mockPool.getDbIsDown()).andReturn(new AtomicBoolean()).anyTimes();
   	expect(mockPool.getConfig()).andReturn(mockConfig).anyTimes();
	replay(mockPool, mockPartition, mockLogger);
	testClass.run();
	EasyMock.verify(mockPartition);
	
	// check exceptional cases
	reset(mockPartition, mockPool, mockLogger);
	resetSignalled();
	first = true;
/		mockPartition.unlockAlmostFullLock();
/		expectLastCall().once();
	
/		mockPartition.lockAlmostFullLock();
/		expectLastCall().andThrow(new RuntimeException());
	replay(mockPartition, mockLogger);
	try{
		testClass.run();
		Assert.fail("Exception should have been thrown");
	} catch (RuntimeException e){
		// do nothing
	}
	EasyMock.verify(mockPartition);
	
	// check case where creating new ConnectionHandle fails
	reset(mockPool, mockLogger, mockConfig);
	reset(mockPartition);
	resetSignalled();
	first = true;
	expect(mockPartition.getFreeConnections()).andReturn(fakeConnections).anyTimes();
	
	expect(mockPartition.getMaxConnections()).andAnswer(new IAnswer<Integer>() {
		// @Override
		public Integer answer() throws Throwable {
			if (first) {
				first=false;
				return 4;
			} 
			Field field = testClass.getClass().getDeclaredField("signalled");
			field.setAccessible(true);
			field.setBoolean(testClass, true);
			return 4;
		}
	}).anyTimes();
	
/		mockPartition.unlockAlmostFullLock();
/		expectLastCall().once();
	
/		mockPartition.lockAlmostFullLock();
/		expectLastCall().once();
	expect(mockConfig.getStatementsCacheSize()).andAnswer(new IAnswer<Integer>() {
		
		// @Override
		public Integer answer() throws Throwable {
			throw new SQLException();
			
		} 
	}).once();
	expect(mockPartition.getAcquireIncrement()).andReturn(1).anyTimes();
	expect(mockPartition.getAvailableConnections()).andReturn(fakeConnections.size()).anyTimes();
   	expect(mockPool.getConfig()).andReturn(mockConfig).anyTimes();
	expect(mockConfig.getAcquireRetryAttempts()).andReturn(0).anyTimes();
	mockLogger.error((String)anyObject(), anyObject());
	expectLastCall(); 
	expect(mockPool.getDbIsDown()).andReturn(new AtomicBoolean()).anyTimes();
	replay(mockPartition, mockPool, mockLogger, mockConfig);
	testClass.run();
	EasyMock.verify(mockPartition);
}