Program: 69926
Project: 69926
Buggy source:
@Ignore @Test @RunAsClient public void checkCreateSubcategory() throws URISyntaxException, IOException {
  RepositoryEntryVO[] wikiVO=new RepositoryEntryVO[COURSES];
  for (int i=0; i < COURSES; i++) {
    wikiVO[i]=functionalVOUtil.importWiki(deploymentUrl);
  }
  CourseVO[] courseVO=new CourseVO[COURSES];
  for (int i=0; i < COURSES; i++) {
    courseVO[i]=functionalVOUtil.importEmptyCourse(deploymentUrl);
  }
  functionalUtil.login(browser);
  for (int i=0; i < SUBCATEGORY_PATHS.length; i++) {
    String currentPath=SUBCATEGORY_PATHS[i];
    String currentName=currentPath.substring(currentPath.lastIndexOf('/') + 1);
    String currentDescription=SUBCATEGORY_DESCRIPTIONS[i];
    Assert.assertTrue(functionalRepositorySiteUtil.createCatalogSubcategory(browser,currentPath.substring(0,currentPath.lastIndexOf('/')),currentName,currentDescription));
  }
  for (int i=0; i < COURSES; i++) {
    Assert.assertTrue(functionalRepositorySiteUtil.openCourse(browser,courseVO[i].getRepoEntryKey()));
    Assert.assertTrue(functionalCourseUtil.openCourseEditor(browser));
    String currentPath=SUBCATEGORY_PATHS[i];
    String currentName=currentPath.substring(currentPath.lastIndexOf('/') + 1);
    Assert.assertTrue(functionalCourseUtil.createCourseNode(browser,CourseNodeAlias.WIKI,"String_Node_Str",currentName + "String_Node_Str","String_Node_Str" + currentName + "String_Node_Str",0));
    Assert.assertTrue(functionalCourseUtil.chooseWiki(browser,wikiVO[i].getKey()));
    Assert.assertTrue(functionalCourseUtil.publishEntireCourse(browser,null,SUBCATEGORY_PATHS[i]));
    Assert.assertTrue(functionalCourseUtil.closeActiveTab(browser));
  }
  Assert.assertTrue(functionalUtil.openSite(browser,FunctionalUtil.OlatSite.LEARNING_RESOURCES));
  Assert.assertTrue(functionalRepositorySiteUtil.openActionByMenuTree(browser,RepositorySiteAction.CATALOG));
  for (int i=0; i < COURSES; i++) {
    String[] selectors=functionalRepositorySiteUtil.createCatalogSelectors(SUBCATECORY_PATHS_INCLUDING_RESOURCE[i]);
    for (    String currentSelector : selectors) {
      StringBuffer selectorBuffer=new StringBuffer();
      selectorBuffer.append("String_Node_Str").append(functionalRepositorySiteUtil.getCourseModuleIconCss()).append("String_Node_Str");
      browser.click(selectorBuffer.toString());
      functionalUtil.waitForPageToLoad(browser);
      String businessPath0=functionalUtil.currentBusinessPath(browser);
      functionalRepositorySiteUtil.openCourse(browser,courseVO[i].getRepoEntryKey());
      String businessPath1=functionalUtil.currentBusinessPath(browser);
      Assert.assertEquals(businessPath1,businessPath0);
    }
  }
}

Fixed version (ground truth):
@Test @RunAsClient public void checkCreateSubcategory() throws URISyntaxException, IOException {
  RepositoryEntryVO[] wikiVO=new RepositoryEntryVO[COURSES];
  for (int i=0; i < COURSES; i++) {
    wikiVO[i]=functionalVOUtil.importWiki(deploymentUrl);
  }
  CourseVO[] courseVO=new CourseVO[COURSES];
  for (int i=0; i < COURSES; i++) {
    courseVO[i]=functionalVOUtil.importEmptyCourse(deploymentUrl);
  }
  functionalUtil.login(browser);
  for (int i=0; i < SUBCATEGORY_PATHS.length; i++) {
    String currentPath=SUBCATEGORY_PATHS[i];
    String currentName=currentPath.substring(currentPath.lastIndexOf('/') + 1);
    String currentDescription=SUBCATEGORY_DESCRIPTIONS[i];
    Assert.assertTrue(functionalRepositorySiteUtil.createCatalogSubcategory(browser,currentPath.substring(0,currentPath.lastIndexOf('/')),currentName,currentDescription));
  }
  for (int i=0; i < COURSES; i++) {
    Assert.assertTrue(functionalRepositorySiteUtil.openCourse(browser,courseVO[i].getRepoEntryKey()));
    Assert.assertTrue(functionalCourseUtil.openCourseEditor(browser));
    String currentPath=SUBCATECORY_PATHS_INCLUDING_RESOURCE[i];
    String currentName=currentPath.substring(currentPath.lastIndexOf('/') + 1);
    Assert.assertTrue(functionalCourseUtil.createCourseNode(browser,CourseNodeAlias.WIKI,"String_Node_Str",currentName + "String_Node_Str","String_Node_Str" + currentName + "String_Node_Str",0));
    Assert.assertTrue(functionalCourseUtil.chooseWiki(browser,wikiVO[i].getKey()));
    Assert.assertTrue(functionalCourseUtil.publishEntireCourse(browser,null,currentPath));
    Assert.assertTrue(functionalCourseUtil.closeActiveTab(browser));
  }
  Assert.assertTrue(functionalUtil.openSite(browser,FunctionalUtil.OlatSite.LEARNING_RESOURCES));
  Assert.assertTrue(functionalRepositorySiteUtil.openActionByMenuTree(browser,RepositorySiteAction.CATALOG));
  for (int i=0; i < COURSES; i++) {
    StringBuffer selectorBuffer=new StringBuffer();
    selectorBuffer.append("String_Node_Str").append(functionalRepositorySiteUtil.getCatalogNavigationCss()).append("String_Node_Str");
    if (browser.isElementPresent(selectorBuffer.toString())) {
      browser.click(selectorBuffer.toString());
    }
    String[] selectors=functionalRepositorySiteUtil.createCatalogSelectors(SUBCATECORY_PATHS_INCLUDING_RESOURCE[i]);
    for (    String currentSelector : selectors) {
      functionalUtil.waitForPageToLoadElement(browser,currentSelector.toString());
      browser.click(currentSelector);
    }
    functionalUtil.waitForPageToLoad(browser);
    selectorBuffer=new StringBuffer();
    selectorBuffer.append("String_Node_Str").append(functionalRepositorySiteUtil.getCourseModuleIconCss()).append("String_Node_Str");
    String businessPath0=functionalUtil.getDeploymentPath() + "String_Node_Str" + courseVO[i].getRepoEntryKey();
    boolean found=false;
    for (int j=0; j < browser.getXpathCount(selectorBuffer.toString().substring(6)).intValue(); j++) {
      functionalUtil.waitForPageToLoadElement(browser,selectorBuffer.toString());
      browser.click(selectorBuffer.toString() + "String_Node_Str" + (j + 1)+ "String_Node_Str");
      functionalUtil.waitForPageToLoad(browser);
      String businessPath1=functionalUtil.currentBusinessPath(browser);
      functionalCourseUtil.closeActiveTab(browser);
      if (businessPath1.contains(businessPath0)) {
        found=true;
        break;
      }
    }
    Assert.assertTrue(found);
  }
}