Program: 137751
Project: 137751
Buggy source:
/** 
 * Test method for   {@link org.talend.dataprofiler.core.ui.action.actions.dqDeleteAction_real#run()}.
 * @throws Exception
 */
@Test public void testRun_2() throws Exception {
  DQRespositoryView dqView=mock(DQRespositoryView.class);
  when(corePlugin.getRepositoryView()).thenReturn(dqView);
  CommonViewer commonView=mock(CommonViewer.class);
  List<RepositoryNode> seleLs=new ArrayList<RepositoryNode>();
  RepositoryNode nodeConn=mock(RepositoryNode.class);
  RepositoryNode nodeAna=mock(RepositoryNode.class);
  IRepositoryObject objectConn=mock(IRepositoryObject.class);
  Property propConn=mock(Property.class);
  ConnectionItem itemConn=mock(ConnectionItem.class);
  ItemState stateConn=mock(ItemState.class);
  when(propConn.getItem()).thenReturn(itemConn);
  when(nodeConn.getObject()).thenReturn(objectConn);
  when(objectConn.getProperty()).thenReturn(propConn);
  when(itemConn.getState()).thenReturn(stateConn);
  when(stateConn.isDeleted()).thenReturn(true);
  IRepositoryObject objectAna=mock(IRepositoryObject.class);
  Property propAna=mock(Property.class);
  Item itemAna=mock(Item.class);
  ItemState stateAna=mock(ItemState.class);
  when(propAna.getItem()).thenReturn(itemAna);
  when(nodeAna.getObject()).thenReturn(objectAna);
  when(objectAna.getProperty()).thenReturn(propAna);
  when(itemAna.getState()).thenReturn(stateAna);
  when(stateAna.isDeleted()).thenReturn(true);
  ModelElement modAna=mock(ModelElement.class);
  ModelElement modConn=mock(ModelElement.class);
  List<ModelElement> dependenceLs=new ArrayList<ModelElement>();
  dependenceLs.add(modAna);
  RepositoryNode nodeOther=mock(RepositoryNode.class);
  IRepositoryObject objectOther=mock(IRepositoryObject.class);
  Property propOther=mock(Property.class);
  ConnectionItem itemOther=mock(ConnectionItem.class);
  ItemState stateOther=mock(ItemState.class);
  when(propOther.getItem()).thenReturn(itemOther);
  when(nodeOther.getObject()).thenReturn(objectOther);
  when(objectOther.getProperty()).thenReturn(propOther);
  when(itemOther.getState()).thenReturn(stateOther);
  when(stateOther.isDeleted()).thenReturn(true);
  seleLs.add(nodeAna);
  seleLs.add(nodeConn);
  seleLs.add(nodeOther);
  ISelection selecetion=new StructuredSelection(seleLs);
  PowerMockito.mockStatic(DeleteModelElementConfirmDialog.class);
  when(DeleteModelElementConfirmDialog.showDialog(null,modConn,dependenceLs.toArray(new ModelElement[dependenceLs.size()]),DefaultMessagesImpl.getString("String_Node_Str","String_Node_Str"),true)).thenReturn(true);
  PowerMockito.mockStatic(RepositoryNodeHelper.class);
  RecycleBinRepNode recyBinNode=mock(RecycleBinRepNode.class);
  when(RepositoryNodeHelper.getRecycleBinRepNode()).thenReturn(recyBinNode);
  when(RepositoryNodeHelper.getResourceModelElement(nodeAna)).thenReturn(modAna);
  when(RepositoryNodeHelper.recursiveFind(modAna)).thenReturn(nodeAna);
  when(RepositoryNodeHelper.recursiveFindRecycleBin(modAna)).thenReturn(nodeAna);
  when(RepositoryNodeHelper.getModelElementFromRepositoryNode(nodeConn)).thenReturn(modConn);
  when(RepositoryNodeHelper.isStateDeleted(nodeConn)).thenReturn(true);
  when(RepositoryNodeHelper.isStateDeleted(nodeAna)).thenReturn(true);
  when(RepositoryNodeHelper.isStateDeleted(nodeOther)).thenReturn(true);
  when(RepositoryNodeHelper.hasDependencyClients(nodeConn)).thenReturn(true);
  PowerMockito.mockStatic(EObjectHelper.class);
  when(EObjectHelper.getDependencyClients(nodeConn)).thenReturn(dependenceLs);
  PowerMockito.mockStatic(PropertyHelper.class);
  when(PropertyHelper.getPropertyFile(modAna)).thenReturn(null);
  when(dqView.getCommonViewer()).thenReturn(commonView);
  when(commonView.getSelection()).thenReturn(selecetion);
  assertNotNull(dqDeleteAction_real.getSelection());
  deleteAction_mock.run();
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.talend.dataprofiler.core.ui.action.actions.dqDeleteAction_real#run()}.
 * @throws Exception
 */
@Test public void testRun_2() throws Exception {
  DQRespositoryView dqView=mock(DQRespositoryView.class);
  when(corePlugin.getRepositoryView()).thenReturn(dqView);
  CommonViewer commonView=mock(CommonViewer.class);
  List<RepositoryNode> seleLs=new ArrayList<RepositoryNode>();
  RepositoryNode nodeConn=mock(RepositoryNode.class);
  RepositoryNode nodeAna=mock(RepositoryNode.class);
  IRepositoryObject objectConn=mock(IRepositoryObject.class);
  Property propConn=mock(Property.class);
  ConnectionItem itemConn=mock(ConnectionItem.class);
  ItemState stateConn=mock(ItemState.class);
  when(propConn.getItem()).thenReturn(itemConn);
  when(nodeConn.getObject()).thenReturn(objectConn);
  when(objectConn.getProperty()).thenReturn(propConn);
  when(itemConn.getState()).thenReturn(stateConn);
  when(stateConn.isDeleted()).thenReturn(true);
  IRepositoryObject objectAna=mock(IRepositoryObject.class);
  Property propAna=mock(Property.class);
  Item itemAna=mock(Item.class);
  ItemState stateAna=mock(ItemState.class);
  when(propAna.getItem()).thenReturn(itemAna);
  when(nodeAna.getObject()).thenReturn(objectAna);
  when(objectAna.getProperty()).thenReturn(propAna);
  when(itemAna.getState()).thenReturn(stateAna);
  when(stateAna.isDeleted()).thenReturn(true);
  ModelElement modAna=mock(ModelElement.class);
  ModelElement modConn=mock(ModelElement.class);
  List<ModelElement> dependenceLs=new ArrayList<ModelElement>();
  dependenceLs.add(modAna);
  RepositoryNode nodeOther=mock(RepositoryNode.class);
  IRepositoryObject objectOther=mock(IRepositoryObject.class);
  Property propOther=mock(Property.class);
  ConnectionItem itemOther=mock(ConnectionItem.class);
  ItemState stateOther=mock(ItemState.class);
  when(propOther.getItem()).thenReturn(itemOther);
  when(nodeOther.getObject()).thenReturn(objectOther);
  when(objectOther.getProperty()).thenReturn(propOther);
  when(itemOther.getState()).thenReturn(stateOther);
  when(stateOther.isDeleted()).thenReturn(true);
  seleLs.add(nodeAna);
  seleLs.add(nodeConn);
  seleLs.add(nodeOther);
  ISelection selecetion=new StructuredSelection(seleLs);
  PowerMockito.mockStatic(DeleteModelElementConfirmDialog.class);
  when(DeleteModelElementConfirmDialog.showDialog(null,modConn,dependenceLs.toArray(new ModelElement[dependenceLs.size()]),DefaultMessagesImpl.getString("String_Node_Str","String_Node_Str"),true)).thenReturn(true);
  PowerMockito.mockStatic(RepositoryNodeHelper.class);
  RecycleBinRepNode recyBinNode=mock(RecycleBinRepNode.class);
  when(RepositoryNodeHelper.getRecycleBinRepNode()).thenReturn(recyBinNode);
  when(RepositoryNodeHelper.getResourceModelElement(nodeAna)).thenReturn(modAna);
  when(RepositoryNodeHelper.recursiveFind(modAna)).thenReturn(nodeAna);
  when(RepositoryNodeHelper.recursiveFindRecycleBin(modAna)).thenReturn(nodeAna);
  when(RepositoryNodeHelper.getModelElementFromRepositoryNode(nodeConn)).thenReturn(modConn);
  when(RepositoryNodeHelper.isStateDeleted(nodeConn)).thenReturn(true);
  when(RepositoryNodeHelper.isStateDeleted(nodeAna)).thenReturn(true);
  when(RepositoryNodeHelper.isStateDeleted(nodeOther)).thenReturn(true);
  when(RepositoryNodeHelper.hasDependencyClients(nodeConn)).thenReturn(true);
  PowerMockito.mockStatic(EObjectHelper.class);
  when(EObjectHelper.getDependencyClients(nodeConn)).thenReturn(dependenceLs);
  PowerMockito.mockStatic(PropertyHelper.class);
  when(PropertyHelper.getPropertyFile(modAna)).thenReturn(null);
  when(dqView.getCommonViewer()).thenReturn(commonView);
  when(commonView.getSelection()).thenReturn(selecetion);
  assertNotNull(dqDeleteAction_real.getSelection());
  PowerMockito.mockStatic(MessageDialog.class);
  stub(method(MessageDialog.class,"String_Node_Str"));
  deleteAction_mock.run();
}