Program: 76055
Project: 76055
Buggy source:
private void testDimensionCreate2(IDocumentManager documentManager) throws IOException, BirtException, DataException {
  ILevelDefn[] levelDefs=new ILevelDefn[3];
  String[] attrs={"String_Node_Str"};
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  levelDefs[1]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  levelDefs[2]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},attrs);
  IDimension dimension=DimensionFactory.createDimension("String_Node_Str",documentManager,new ThreeLevelDataset(),levelDefs,false);
  IHierarchy hierarchy=dimension.getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  ILevel[] level=hierarchy.getLevels();
  assertEquals(level[0].getName(),"String_Node_Str");
  assertEquals(level[0].getKeyDataType("String_Node_Str"),DataType.STRING_TYPE);
  assertEquals(level[1].getName(),"String_Node_Str");
  assertEquals(level[1].getKeyDataType("String_Node_Str"),DataType.STRING_TYPE);
  assertEquals(level[2].getName(),"String_Node_Str");
  assertEquals(level[2].getKeyDataType("String_Node_Str"),DataType.STRING_TYPE);
  Dimension realDimension=(Dimension)dimension;
  for (int i=0; i < ThreeLevelDataset.Level1Col.length; i++) {
    System.out.println(i);
    IndexKey indexKey=realDimension.findFirst((Level)level[0],new Object[]{ThreeLevelDataset.Level1Col[i]});
    assertEquals(indexKey.key[0],ThreeLevelDataset.Level1Col[i]);
    if (i < 5)     assertEquals(indexKey.dimensionPos,0);
    if (i >= 5 && i < 12)     assertEquals(indexKey.dimensionPos,5);
    if (i >= 12)     assertEquals(indexKey.dimensionPos,12);
    Member levelMember=realDimension.getRowByPosition(indexKey.dimensionPos).getMembers()[0];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level1Col[i]);
    assertTrue(levelMember.getAttributes() == null);
    levelMember=realDimension.getDimensionRowByOffset(indexKey.offset).getMembers()[0];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level1Col[i]);
    assertTrue(levelMember.getAttributes() == null);
    indexKey=realDimension.findFirst((Level)level[1],new Object[]{ThreeLevelDataset.Level2Col[i]});
    assertEquals(indexKey.key[0],ThreeLevelDataset.Level2Col[i]);
    levelMember=realDimension.getRowByPosition(indexKey.dimensionPos).getMembers()[1];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level2Col[i]);
    assertTrue(levelMember.getAttributes() == null);
    levelMember=realDimension.getDimensionRowByOffset(indexKey.offset).getMembers()[1];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level2Col[i]);
    assertTrue(levelMember.getAttributes() == null);
    indexKey=realDimension.findFirst((Level)level[2],new Object[]{ThreeLevelDataset.Level3Col[i]});
    assertEquals(indexKey.key[0],ThreeLevelDataset.Level3Col[i]);
    assertEquals(indexKey.dimensionPos,i);
    levelMember=realDimension.getRowByPosition(indexKey.dimensionPos).getMembers()[2];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level3Col[i]);
    levelMember=realDimension.getDimensionRowByOffset(indexKey.offset).getMembers()[2];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level3Col[i]);
  }
}

Fixed version (ground truth):
private void testDimensionCreate2(IDocumentManager documentManager) throws IOException, BirtException, DataException {
  ILevelDefn[] levelDefs=new ILevelDefn[3];
  String[] attrs={"String_Node_Str"};
  levelDefs[0]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  levelDefs[1]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},null);
  levelDefs[2]=new LevelDefinition("String_Node_Str",new String[]{"String_Node_Str"},attrs);
  IDimension dimension=DimensionFactory.createDimension("String_Node_Str",documentManager,new ThreeLevelDataset(),levelDefs,false);
  IHierarchy hierarchy=dimension.getHierarchy();
  assertEquals(hierarchy.getName(),"String_Node_Str");
  ILevel[] level=hierarchy.getLevels();
  assertEquals(level[0].getName(),"String_Node_Str");
  assertEquals(level[0].getKeyDataType("String_Node_Str"),DataType.STRING_TYPE);
  assertEquals(level[1].getName(),"String_Node_Str");
  assertEquals(level[1].getKeyDataType("String_Node_Str"),DataType.STRING_TYPE);
  assertEquals(level[2].getName(),"String_Node_Str");
  assertEquals(level[2].getKeyDataType("String_Node_Str"),DataType.STRING_TYPE);
  Dimension realDimension=(Dimension)dimension;
  for (int i=0; i < ThreeLevelDataset.Level1Col.length; i++) {
    System.out.println(i);
    IndexKey indexKey=realDimension.findFirst((Level)level[0],new Object[]{ThreeLevelDataset.Level1Col[i]});
    assertEquals(indexKey.getKey()[0],ThreeLevelDataset.Level1Col[i]);
    if (i < 5)     assertEquals(indexKey.getDimensionPos(),0);
    if (i >= 5 && i < 12)     assertEquals(indexKey.getDimensionPos(),5);
    if (i >= 12)     assertEquals(indexKey.getDimensionPos(),12);
    Member levelMember=realDimension.getRowByPosition(indexKey.getDimensionPos()).getMembers()[0];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level1Col[i]);
    assertTrue(levelMember.getAttributes() == null);
    levelMember=realDimension.getDimensionRowByOffset(indexKey.getOffset()).getMembers()[0];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level1Col[i]);
    assertTrue(levelMember.getAttributes() == null);
    indexKey=realDimension.findFirst((Level)level[1],new Object[]{ThreeLevelDataset.Level2Col[i]});
    assertEquals(indexKey.getKey()[0],ThreeLevelDataset.Level2Col[i]);
    levelMember=realDimension.getRowByPosition(indexKey.getDimensionPos()).getMembers()[1];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level2Col[i]);
    assertTrue(levelMember.getAttributes() == null);
    levelMember=realDimension.getDimensionRowByOffset(indexKey.getOffset()).getMembers()[1];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level2Col[i]);
    assertTrue(levelMember.getAttributes() == null);
    indexKey=realDimension.findFirst((Level)level[2],new Object[]{ThreeLevelDataset.Level3Col[i]});
    assertEquals(indexKey.getKey()[0],ThreeLevelDataset.Level3Col[i]);
    assertEquals(indexKey.getDimensionPos(),i);
    levelMember=realDimension.getRowByPosition(indexKey.getDimensionPos()).getMembers()[2];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level3Col[i]);
    levelMember=realDimension.getDimensionRowByOffset(indexKey.getOffset()).getMembers()[2];
    assertEquals(levelMember.getKeyValues()[0],ThreeLevelDataset.Level3Col[i]);
  }
}