@Test
 public void testGetConnectionByName() throws Exception {
   doNothing().when(connectionServiceImpl).ensureDataAccessPermission();
   doReturn(mockDBConnection)
       .when(connectionServiceImpl.datasourceMgmtSvc)
       .getDatasourceByName(CONN_NAME);
   IDatabaseConnection connection = connectionServiceImpl.getConnectionByName(CONN_NAME);
   verify(connectionServiceImpl).getConnectionByName(CONN_NAME);
   assertEquals(mockDBConnection, connection);
 }
 @Test
 public void testGetConnectionByNameError_NullDataSource() throws Exception {
   doNothing().when(connectionServiceImpl).ensureDataAccessPermission();
   doReturn(null).when(connectionServiceImpl.datasourceMgmtSvc).getDatasourceByName(CONN_NAME);
   try {
     connectionServiceImpl.getConnectionByName(CONN_NAME);
     fail(); // This line should never be reached
   } catch (ConnectionServiceException e) {
     // Expected exception
   }
 }