Program: 137600
Project: 137600
Buggy source:
/** 
 * Test method for   {@link org.talend.dataprofiler.core.ui.action.actions.ExportConnectionToTOSAction#run()}.
 * @throws PersistenceException case1: create new connection from catalog case
 */
@Test public void testRuncase1() throws PersistenceException {
  DatabaseConnectionItem createOldConnectionItem=createConnectionItem("String_Node_Str",null,false,true);
  initCatalogList(createOldConnectionItem);
  List<Package> packageList=new ArrayList<Package>();
  packageList.add(catalog1);
  createAction=PowerMockito.spy(new ExportConnectionToTOSAction(packageList));
  PowerMockito.doNothing().when(createAction).openSuccessInformation();
  PowerMockito.doNothing().when(createAction).refreshViewerAndNode();
  createAction.run();
  List<IRepositoryViewObject> all=factory.getAll(ERepositoryObjectType.METADATA_CONNECTIONS,false);
  Assert.assertTrue(all.size() == 2);
  IRepositoryViewObject lastVersion=all.get(1);
  DatabaseConnectionItem item=(DatabaseConnectionItem)lastVersion.getProperty().getItem();
  Connection newConnection=item.getConnection();
  Catalog exportedCatalog=CatalogHelper.getCatalog(newConnection,catalog1.getName());
  Assert.assertTrue(newConnection.getLabel().equals(createOldConnectionItem.getConnection().getLabel() + "String_Node_Str" + catalog1.getName()));
  Assert.assertTrue(exportedCatalog != null);
  Assert.assertTrue(exportedCatalog != catalog1);
  factory.deleteObjectPhysical(lastVersion);
  factory.deleteObjectPhysical(all.get(0));
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.talend.dataprofiler.core.ui.action.actions.ExportConnectionToTOSAction#run()}.
 * @throws PersistenceException case1: create new connection from catalog case
 */
@Test public void testRuncase1() throws PersistenceException {
  DatabaseConnectionItem createOldConnectionItem=createConnectionItem("String_Node_Str",null,false,true);
  Assert.assertTrue(createOldConnectionItem.getConnection() != null);
  Assert.assertTrue(createOldConnectionItem.getConnection().eResource() != null);
  Assert.assertTrue(!createOldConnectionItem.getConnection().eIsProxy());
  initCatalogList(createOldConnectionItem);
  List<Package> packageList=new ArrayList<Package>();
  packageList.add(catalog1);
  createAction=PowerMockito.spy(new ExportConnectionToTOSAction(packageList));
  PowerMockito.doNothing().when(createAction).openSuccessInformation();
  PowerMockito.doNothing().when(createAction).refreshViewerAndNode();
  createAction.run();
  List<IRepositoryViewObject> all=factory.getAll(ERepositoryObjectType.METADATA_CONNECTIONS,false);
  Assert.assertTrue(all != null);
  Assert.assertTrue(all.size() == 2);
  IRepositoryViewObject lastVersion=all.get(1);
  DatabaseConnectionItem item=(DatabaseConnectionItem)lastVersion.getProperty().getItem();
  Connection newConnection=item.getConnection();
  Catalog exportedCatalog=CatalogHelper.getCatalog(newConnection,catalog1.getName());
  Assert.assertTrue(newConnection.getLabel().equals(createOldConnectionItem.getConnection().getLabel() + "String_Node_Str" + catalog1.getName()));
  Assert.assertTrue(exportedCatalog != null);
  Assert.assertTrue(exportedCatalog != catalog1);
  factory.deleteObjectPhysical(lastVersion);
  factory.deleteObjectPhysical(all.get(0));
}