private void testAddConnectionError(Exception ex) throws Exception {
   doNothing().when(connectionServiceImpl).ensureDataAccessPermission();
   doThrow(ex).when(connectionServiceImpl.datasourceMgmtSvc).createDatasource(mockDBConnection);
   try {
     connectionServiceImpl.addConnection(mockDBConnection);
     fail(); // This line should never be reached
   } catch (ConnectionServiceException e) {
     // Expected exception
   }
 }
 @Test
 public void testAddConnection() throws Exception {
   doNothing().when(connectionServiceImpl).ensureDataAccessPermission();
   assertTrue(connectionServiceImpl.addConnection(mockDBConnection));
 }