Program: 74089
Project: 74089
Buggy source:
/** 
 * Test grand total
 * @throws Exception
 */
public void testAggrSort3() throws Exception {
  ICubeQueryDefinition cqd=new CubeQueryDefinition(cubeName);
  IEdgeDefinition columnEdge=cqd.createEdge(ICubeQueryDefinition.COLUMN_EDGE);
  IEdgeDefinition rowEdge=cqd.createEdge(ICubeQueryDefinition.ROW_EDGE);
  IDimensionDefinition dim1=columnEdge.createDimension("String_Node_Str");
  IHierarchyDefinition hier1=dim1.createHierarchy("String_Node_Str");
  ILevelDefinition level11=hier1.createLevel("String_Node_Str");
  ILevelDefinition level12=hier1.createLevel("String_Node_Str");
  hier1.createLevel("String_Node_Str");
  IDimensionDefinition dim2=rowEdge.createDimension("String_Node_Str");
  IHierarchyDefinition hier2=dim2.createHierarchy("String_Node_Str");
  ILevelDefinition level21=hier2.createLevel("String_Node_Str");
  createSortTestBindings(cqd);
  CubeSortDefinition sorter1=new CubeSortDefinition();
  sorter1.setExpression("String_Node_Str");
  sorter1.setAxisQualifierLevels(null);
  sorter1.setAxisQualifierValues(null);
  sorter1.setTargetLevel(level21);
  sorter1.setSortDirection(ISortDefinition.SORT_DESC);
  CubeSortDefinition sorter2=new CubeSortDefinition();
  sorter2.setExpression("String_Node_Str");
  sorter2.setAxisQualifierLevels(new ILevelDefinition[]{level21});
  sorter2.setAxisQualifierValues(new Object[]{"String_Node_Str"});
  sorter2.setTargetLevel(level12);
  sorter2.setSortDirection(ISortDefinition.SORT_DESC);
  CubeSortDefinition sorter3=new CubeSortDefinition();
  sorter3.setExpression("String_Node_Str");
  sorter3.setAxisQualifierLevels(new ILevelDefinition[]{level21});
  sorter3.setAxisQualifierValues(new Object[]{"String_Node_Str"});
  sorter3.setTargetLevel(level11);
  sorter3.setSortDirection(ISortDefinition.SORT_DESC);
  cqd.addSort(sorter1);
  cqd.addSort(sorter2);
  cqd.addSort(sorter3);
  DataEngine engine=DataEngine.newDataEngine(DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,null,null,null));
  this.createCube(engine);
  IPreparedCubeQuery pcq=engine.prepare(cqd,null);
  ICubeQueryResults queryResults=pcq.execute(null);
  CubeCursor cursor=queryResults.getCubeCursor();
  List columnEdgeBindingNames=new ArrayList();
  columnEdgeBindingNames.add("String_Node_Str");
  columnEdgeBindingNames.add("String_Node_Str");
  columnEdgeBindingNames.add("String_Node_Str");
  printCube(cursor,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"},"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Test grand total
 * @throws Exception
 */
public void testAggrSort3() throws Exception {
  ICubeQueryDefinition cqd=new CubeQueryDefinition(cubeName);
  IEdgeDefinition columnEdge=cqd.createEdge(ICubeQueryDefinition.COLUMN_EDGE);
  IEdgeDefinition rowEdge=cqd.createEdge(ICubeQueryDefinition.ROW_EDGE);
  IDimensionDefinition dim1=columnEdge.createDimension("String_Node_Str");
  IHierarchyDefinition hier1=dim1.createHierarchy("String_Node_Str");
  ILevelDefinition level11=hier1.createLevel("String_Node_Str");
  ILevelDefinition level12=hier1.createLevel("String_Node_Str");
  hier1.createLevel("String_Node_Str");
  IDimensionDefinition dim2=rowEdge.createDimension("String_Node_Str");
  IHierarchyDefinition hier2=dim2.createHierarchy("String_Node_Str");
  ILevelDefinition level21=hier2.createLevel("String_Node_Str");
  createSortTestBindings(cqd);
  CubeSortDefinition sorter1=new CubeSortDefinition();
  sorter1.setExpression("String_Node_Str");
  sorter1.setAxisQualifierLevels(null);
  sorter1.setAxisQualifierValues(null);
  sorter1.setTargetLevel(level21);
  sorter1.setSortDirection(ISortDefinition.SORT_DESC);
  CubeSortDefinition sorter2=new CubeSortDefinition();
  sorter2.setExpression("String_Node_Str");
  sorter2.setAxisQualifierLevels(new ILevelDefinition[]{level21});
  sorter2.setAxisQualifierValues(new Object[]{"String_Node_Str"});
  sorter2.setTargetLevel(level12);
  sorter2.setSortDirection(ISortDefinition.SORT_DESC);
  CubeSortDefinition sorter3=new CubeSortDefinition();
  sorter3.setExpression("String_Node_Str");
  sorter3.setAxisQualifierLevels(new ILevelDefinition[]{level21});
  sorter3.setAxisQualifierValues(new Object[]{"String_Node_Str"});
  sorter3.setTargetLevel(level11);
  sorter3.setSortDirection(ISortDefinition.SORT_DESC);
  cqd.addSort(sorter1);
  cqd.addSort(sorter2);
  cqd.addSort(sorter3);
  DataEngineImpl engine=(DataEngineImpl)DataEngine.newDataEngine(DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,null,null,null));
  this.createCube(engine);
  IPreparedCubeQuery pcq=engine.prepare(cqd,null);
  ICubeQueryResults queryResults=pcq.execute(null);
  CubeCursor cursor=queryResults.getCubeCursor();
  List columnEdgeBindingNames=new ArrayList();
  columnEdgeBindingNames.add("String_Node_Str");
  columnEdgeBindingNames.add("String_Node_Str");
  columnEdgeBindingNames.add("String_Node_Str");
  printCube(cursor,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"},"String_Node_Str","String_Node_Str");
}