Program: 119449
Project: 119449
Buggy source:
@Test public void testDiDemoJobItemsComplete() throws Exception {
  Assert.assertTrue(diResManager instanceof FileResourcesUnityManager);
  Iterator path=diResManager.getPaths().iterator();
  String firstFilePath=((Path)path.next()).toPortableString();
  String tempFolderPath=firstFilePath.substring(0,firstFilePath.indexOf(TEMP_FOLDER_SUFFIEX) + TEMP_FOLDER_SUFFIEX.length());
  Assert.assertTrue(new File(tempFolderPath).exists());
  String rootPath=tempFolderPath + File.separator + demoName;
  Assert.assertTrue(new File(rootPath).exists());
  File tempJobsFolder=new File(rootPath + File.separator + processItemPath);
  List<File> demoJobItemFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempJobsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoJobItemFiles.size() > 0);
  int currentJobItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.PROCESS).size();
  Assert.assertTrue(currentJobItemsSize > 0);
  Assert.assertEquals(demoJobItemFiles.size() - 1,currentJobItemsSize);
  int currentContextItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.CONTEXT).size();
  File tempContextItemsFolder=new File(rootPath + File.separator + contextItemPath);
  List<File> demoContextItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempContextItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoContextItemsFiles.size() > 0);
  Assert.assertTrue(currentContextItemsSize > 0);
  Assert.assertEquals(demoContextItemsFiles.size(),currentContextItemsSize);
  int currentConnectionItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.METADATA).size();
  File tempConnItemsFolder=new File(rootPath + File.separator + connectionItemPath);
  List<File> demoConItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempConnItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoConItemsFiles.size() > 0);
  Assert.assertTrue(currentConnectionItemsSize > 0);
  Assert.assertEquals(demoConItemsFiles.size(),currentConnectionItemsSize);
  int currentRoutineItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.ROUTINES).size();
  int systemRoutineItemsSize=13;
  File tempRoutineItemsFolder=new File(rootPath + File.separator + routineItemPath);
  List<File> demoRoutineItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempRoutineItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoRoutineItemsFiles.size() > 0);
  Assert.assertTrue(currentRoutineItemsSize > 0);
  Assert.assertEquals(demoRoutineItemsFiles.size() - systemRoutineItemsSize,currentRoutineItemsSize);
  int currentBusinessItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.BUSINESS_PROCESS).size();
  File tempBusinessItemsFolder=new File(rootPath + File.separator + bussniessProcessPath);
  List<File> demoBusinessItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempBusinessItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoBusinessItemsFiles.size() > 0);
  Assert.assertTrue(currentBusinessItemsSize > 0);
  Assert.assertEquals(demoBusinessItemsFiles.size(),currentBusinessItemsSize);
  int currentSqlPatternSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.SQLPATTERNS).size();
  File tempSqlPatternFolder=new File(rootPath + File.separator + sqlPatternPath);
  List<File> demoSqlPatternFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempSqlPatternFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertEquals(demoSqlPatternFiles.size(),54);
  Assert.assertTrue(currentSqlPatternSize == 0);
  int currentDocItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.DOCUMENTATION).size();
  File tempDocItemsFolder=new File(rootPath + File.separator + documentionPath);
  List<File> demoDocItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempDocItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoDocItemsFiles.size() > 0);
  Assert.assertTrue(currentDocItemsSize > 0);
  Assert.assertEquals(demoDocItemsFiles.size(),currentDocItemsSize);
}

Fixed version (ground truth):
@Test public void testDiDemoJobItemsComplete() throws Exception {
  Assert.assertTrue(diResManager instanceof FileResourcesUnityManager);
  Iterator path=diResManager.getPaths().iterator();
  String firstFilePath=((Path)path.next()).toPortableString();
  String tempFolderPath=firstFilePath.substring(0,firstFilePath.indexOf(TEMP_FOLDER_SUFFIEX) + TEMP_FOLDER_SUFFIEX.length());
  Assert.assertTrue(new File(tempFolderPath).exists());
  String rootPath=tempFolderPath + File.separator + demoName;
  Assert.assertTrue(new File(rootPath).exists());
  File tempJobsFolder=new File(rootPath + File.separator + processItemPath);
  List<File> demoJobItemFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempJobsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoJobItemFiles.size() > 0);
  int currentJobItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.PROCESS).size();
  Assert.assertTrue(currentJobItemsSize > 0);
  Assert.assertEquals(demoJobItemFiles.size() - 1,currentJobItemsSize);
  int currentContextItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.CONTEXT).size();
  File tempContextItemsFolder=new File(rootPath + File.separator + contextItemPath);
  List<File> demoContextItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempContextItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoContextItemsFiles.size() > 0);
  Assert.assertTrue(currentContextItemsSize > 0);
  Assert.assertEquals(demoContextItemsFiles.size(),currentContextItemsSize);
  int currentConnectionItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.METADATA).size();
  File tempConnItemsFolder=new File(rootPath + File.separator + connectionItemPath);
  List<File> demoConItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempConnItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoConItemsFiles.size() > 0);
  Assert.assertTrue(currentConnectionItemsSize > 0);
  Assert.assertEquals(demoConItemsFiles.size(),currentConnectionItemsSize);
  int currentRoutineItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.ROUTINES).size();
  File tempRoutineItemsFolder=new File(rootPath + File.separator + routineItemPath);
  List<File> demoRoutineItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempRoutineItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoRoutineItemsFiles.size() > 0);
  Assert.assertTrue(currentRoutineItemsSize > 0);
  Assert.assertEquals(demoRoutineItemsFiles.size(),currentRoutineItemsSize);
  int currentBusinessItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.BUSINESS_PROCESS).size();
  File tempBusinessItemsFolder=new File(rootPath + File.separator + bussniessProcessPath);
  List<File> demoBusinessItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempBusinessItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoBusinessItemsFiles.size() > 0);
  Assert.assertTrue(currentBusinessItemsSize > 0);
  Assert.assertEquals(demoBusinessItemsFiles.size(),currentBusinessItemsSize);
  int currentDocItemsSize=ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.DOCUMENTATION).size();
  File tempDocItemsFolder=new File(rootPath + File.separator + documentionPath);
  List<File> demoDocItemsFiles=DemoImportTestUtil.collectProjectFilesFromDirectory(tempDocItemsFolder,FileConstants.ITEM_EXTENSION,true);
  Assert.assertTrue(demoDocItemsFiles.size() > 0);
  Assert.assertTrue(currentDocItemsSize > 0);
  Assert.assertEquals(demoDocItemsFiles.size(),currentDocItemsSize);
}