Program: 136557
Project: 136557
Buggy source:
/** 
 * Test method for   {@link org.talend.dataprofiler.core.ui.imex.model.ItemRecord#loadProperty()}.
 * @throws PersistenceException
 */
@Test public void testLoadProperty() throws PersistenceException {
  Property analysisProperty=createAnalysis("String_Node_Str");
  TDQAnalysisItem item=(TDQAnalysisItem)analysisProperty.getItem();
  Analysis analysis=item.getAnalysis();
  AnalysisResult createAnalysisResult=analysis.getResults();
  Assert.assertEquals(0,createAnalysisResult.getIndicators().size());
  RowCountIndicator rowCountIndicator=IndicatorsFactory.eINSTANCE.createRowCountIndicator();
  String rowCountPropertyID=EcoreUtil.generateUUID();
  saveIndicatorDefintion(rowCountPropertyID,"String_Node_Str");
  rowCountIndicator.setIndicatorDefinition(((TDQIndicatorDefinitionItem)ProxyRepositoryFactory.getInstance().getLastVersion(rowCountPropertyID).getProperty().getItem()).getIndicatorDefinition());
  Assert.assertNotNull("String_Node_Str",rowCountIndicator.getIndicatorDefinition());
  System.out.println("String_Node_Str" + rowCountIndicator.getIndicatorDefinition().getLabel());
  Assert.assertEquals("String_Node_Str",rowCountIndicator.getIndicatorDefinition().getLabel());
  createAnalysisResult.getIndicators().add(rowCountIndicator);
  Assert.assertEquals(1,createAnalysisResult.getIndicators().size());
  ReturnCode saveAnalysis=saveAnalysis(analysis);
  Assert.assertEquals(1,((TDQAnalysisItem)analysisProperty.getItem()).getAnalysis().getResults().getIndicators().size());
  Assert.assertTrue("String_Node_Str",saveAnalysis.isOk());
  File analysisFile=WorkspaceUtils.ifileToFile(PropertyHelper.getItemFile(analysisProperty));
  ItemRecord itemRecord=new ItemRecord(analysisFile);
  Assert.assertEquals(1,itemRecord.getDependencySet().size());
  NullCountIndicator nullCountIndicator=IndicatorsFactory.eINSTANCE.createNullCountIndicator();
  String nullCountPropertyID=EcoreUtil.generateUUID();
  saveIndicatorDefintion(nullCountPropertyID,"String_Node_Str");
  nullCountIndicator.setIndicatorDefinition(((TDQIndicatorDefinitionItem)ProxyRepositoryFactory.getInstance().getLastVersion(nullCountPropertyID).getProperty().getItem()).getIndicatorDefinition());
  analysis=item.getAnalysis();
  analysis.getResults().getIndicators().add(nullCountIndicator);
  ReturnCode saveAnalysis2=saveAnalysis(analysis);
  Assert.assertTrue("String_Node_Str",saveAnalysis2.isOk());
  itemRecord=new ItemRecord(analysisFile);
  Assert.assertEquals(1,itemRecord.getDependencySet().size());
  ItemRecord.clear();
  itemRecord=new ItemRecord(analysisFile);
  Assert.assertEquals(2,itemRecord.getDependencySet().size());
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.talend.dataprofiler.core.ui.imex.model.ItemRecord#loadProperty()}.
 * @throws PersistenceException
 */
@Test public void testLoadProperty() throws PersistenceException {
  Property analysisProperty=createAnalysis("String_Node_Str");
  TDQAnalysisItem item=(TDQAnalysisItem)analysisProperty.getItem();
  Analysis analysis=item.getAnalysis();
  AnalysisResult createAnalysisResult=analysis.getResults();
  Assert.assertEquals(0,createAnalysisResult.getIndicators().size());
  RowCountIndicator rowCountIndicator=IndicatorsFactory.eINSTANCE.createRowCountIndicator();
  String rowCountPropertyID=EcoreUtil.generateUUID();
  saveIndicatorDefintion(rowCountPropertyID,"String_Node_Str");
  rowCountIndicator.setIndicatorDefinition(((TDQIndicatorDefinitionItem)ProxyRepositoryFactory.getInstance().getLastVersion(rowCountPropertyID).getProperty().getItem()).getIndicatorDefinition());
  Assert.assertNotNull("String_Node_Str",rowCountIndicator.getIndicatorDefinition());
  Assert.assertEquals("String_Node_Str",rowCountIndicator.getIndicatorDefinition().getLabel());
  createAnalysisResult.getIndicators().add(rowCountIndicator);
  Assert.assertEquals(1,createAnalysisResult.getIndicators().size());
  ReturnCode saveAnalysis=saveAnalysis(analysis);
  Assert.assertEquals(1,((TDQAnalysisItem)analysisProperty.getItem()).getAnalysis().getResults().getIndicators().size());
  Assert.assertTrue("String_Node_Str",saveAnalysis.isOk());
  File analysisFile=WorkspaceUtils.ifileToFile(PropertyHelper.getItemFile(analysisProperty));
  ItemRecord itemRecord=new ItemRecord(analysisFile);
  Assert.assertEquals(1,itemRecord.getDependencySet().size());
  NullCountIndicator nullCountIndicator=IndicatorsFactory.eINSTANCE.createNullCountIndicator();
  String nullCountPropertyID=EcoreUtil.generateUUID();
  saveIndicatorDefintion(nullCountPropertyID,"String_Node_Str");
  nullCountIndicator.setIndicatorDefinition(((TDQIndicatorDefinitionItem)ProxyRepositoryFactory.getInstance().getLastVersion(nullCountPropertyID).getProperty().getItem()).getIndicatorDefinition());
  analysis=item.getAnalysis();
  analysis.getResults().getIndicators().add(nullCountIndicator);
  ReturnCode saveAnalysis2=saveAnalysis(analysis);
  Assert.assertTrue("String_Node_Str",saveAnalysis2.isOk());
  itemRecord=new ItemRecord(analysisFile);
  Assert.assertEquals(1,itemRecord.getDependencySet().size());
  ItemRecord.clear();
  itemRecord=new ItemRecord(analysisFile);
  Assert.assertEquals(2,itemRecord.getDependencySet().size());
}