Program: 74097
Project: 74097
Buggy source:
/** 
 * Test grand total
 * @throws Exception
 */
public void testAggrSort() 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");
  ILevelDefinition level13=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);
  CubeSortDefinition sorter4=new CubeSortDefinition();
  sorter4.setExpression("String_Node_Str");
  sorter4.setAxisQualifierLevels(null);
  sorter4.setAxisQualifierValues(null);
  sorter4.setTargetLevel(level13);
  sorter4.setSortDirection(ISortDefinition.SORT_DESC);
  CubeSortDefinition sorter5=new CubeSortDefinition();
  sorter5.setExpression("String_Node_Str");
  sorter5.setAxisQualifierLevels(null);
  sorter5.setAxisQualifierValues(null);
  sorter5.setTargetLevel(level11);
  sorter5.setSortDirection(ISortDefinition.SORT_DESC);
  cqd.addSort(sorter1);
  cqd.addSort(sorter2);
  cqd.addSort(sorter3);
  cqd.addSort(sorter4);
  cqd.addSort(sorter5);
  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 testAggrSort() 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");
  ILevelDefinition level13=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);
  CubeSortDefinition sorter4=new CubeSortDefinition();
  sorter4.setExpression("String_Node_Str");
  sorter4.setAxisQualifierLevels(null);
  sorter4.setAxisQualifierValues(null);
  sorter4.setTargetLevel(level13);
  sorter4.setSortDirection(ISortDefinition.SORT_DESC);
  CubeSortDefinition sorter5=new CubeSortDefinition();
  sorter5.setExpression("String_Node_Str");
  sorter5.setAxisQualifierLevels(null);
  sorter5.setAxisQualifierValues(null);
  sorter5.setTargetLevel(level11);
  sorter5.setSortDirection(ISortDefinition.SORT_DESC);
  cqd.addSort(sorter1);
  cqd.addSort(sorter2);
  cqd.addSort(sorter3);
  cqd.addSort(sorter4);
  cqd.addSort(sorter5);
  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");
}