### Question:
ConnectionServiceImpl extends PentahoBase implements IConnectionService { public boolean updateConnection( IDatabaseConnection connection ) throws ConnectionServiceException { ensureDataAccessPermission(); try { connection.setPassword( getConnectionPassword( connection.getName(), connection .getPassword() ) ); datasourceMgmtSvc.updateDatasourceByName( connection.getName(), connection ); clearDatasource( connection.getName() ); return true; } catch ( NonExistingDatasourceException nonExistingDatasourceException ) { String message = Messages.getErrorString( "ConnectionServiceImpl.ERROR_0005_UNABLE_TO_UPDATE_CONNECTION", connection.getName(), nonExistingDatasourceException.getLocalizedMessage() ); throw new ConnectionServiceException( Response.SC_NOT_FOUND, message, nonExistingDatasourceException ); } catch ( Exception e ) { String message = Messages.getErrorString( "ConnectionServiceImpl.ERROR_0005_UNABLE_TO_UPDATE_CONNECTION", connection.getName(), e.getLocalizedMessage() ); logger.error( message ); throw new ConnectionServiceException( message, e ); } } ConnectionServiceImpl(); Log getLogger(); boolean hasDataAccessPermission(); void ensureDataAccessPermission(); List<IDatabaseConnection> getConnections(); List<IDatabaseConnection> getConnections( boolean hidePassword ); IDatabaseConnection getConnectionByName( String name ); IDatabaseConnection getConnectionByName( String name, boolean doUnsanitize ); IDatabaseConnection getConnectionById( String id ); boolean addConnection( IDatabaseConnection connection ); boolean updateConnection( IDatabaseConnection connection ); boolean deleteConnection( IDatabaseConnection connection ); boolean deleteConnection( String name ); boolean testConnection( IDatabaseConnection connection ); boolean isConnectionExist( String connectionName );  }### Answer:
@Test public void testUpdateConnection() throws Exception { doNothing().when( connectionServiceImpl ).ensureDataAccessPermission(); doReturn( "" ).when( connectionServiceImpl ).getConnectionPassword( anyString(), anyString() ); assertTrue( connectionServiceImpl.updateConnection( mockDBConnection ) ); verify( connectionServiceImpl ).updateConnection( mockDBConnection ); verify( datasourceService ).clearDataSource( CONN_NAME ); }