Program: 56592
Project: 56592
Buggy source:
@Test public void testMergeCells(){
  XSheet sheet1=_workbook.getWorksheet("String_Node_Str");
  Row row1=sheet1.getRow(0);
  Row row2=sheet1.getRow(1);
  Row row6=sheet1.getRow(5);
  Row row7=sheet1.getRow(6);
  Row row9=sheet1.getRow(8);
  Row row10=sheet1.getRow(9);
  Row row11=sheet1.getRow(10);
  Row row12=sheet1.getRow(11);
  assertEquals(Cell.CELL_TYPE_BLANK,row1.getCell(0).getCellType());
  assertEquals(Cell.CELL_TYPE_BLANK,row1.getCell(1).getCellType());
  assertNull(row1.getCell(2));
  assertEquals(Cell.CELL_TYPE_BLANK,row2.getCell(0).getCellType());
  assertEquals(Cell.CELL_TYPE_BLANK,row2.getCell(1).getCellType());
  assertNull(row2.getCell(2));
  assertEquals(1,row9.getCell(0).getNumericCellValue(),0.0000000000000001);
  assertEquals(2,row7.getCell(3).getNumericCellValue(),0.0000000000000001);
  assertNull(sheet1.getRow(4));
  Cell cellC6=row6.getCell(2);
  CellValue valueC6=_evaluator.evaluate(cellC6);
  assertEquals(1,valueC6.getNumberValue(),0.0000000000000001);
  assertEquals(Cell.CELL_TYPE_NUMERIC,valueC6.getCellType());
  testToFormulaString(cellC6,"String_Node_Str");
  Cell cellA10=row10.getCell(0);
  CellValue valueA10=_evaluator.evaluate(cellA10);
  assertEquals(1,valueA10.getNumberValue(),0.0000000000000001);
  assertEquals(Cell.CELL_TYPE_NUMERIC,valueA10.getCellType());
  testToFormulaString(cellA10,"String_Node_Str");
  Cell cellA11=row11.getCell(0);
  CellValue valueA11=_evaluator.evaluate(cellA11);
  assertEquals(0,valueA11.getNumberValue(),0.0000000000000001);
  assertEquals(Cell.CELL_TYPE_NUMERIC,valueA11.getCellType());
  testToFormulaString(cellA11,"String_Node_Str");
  Cell cellA12=row12.getCell(0);
  CellValue valueA12=_evaluator.evaluate(cellA12);
  assertEquals(2,valueA12.getNumberValue(),0.0000000000000001);
  assertEquals(Cell.CELL_TYPE_NUMERIC,valueA12.getCellType());
  testToFormulaString(cellA12,"String_Node_Str");
  BookHelper.merge(sheet1,4,1,6,3,true);
  Row row5=sheet1.getRow(4);
  assertEquals(Cell.CELL_TYPE_FORMULA,row5.getCell(1).getCellType());
  assertEquals(Cell.CELL_TYPE_BLANK,row5.getCell(2).getCellType());
  assertEquals(Cell.CELL_TYPE_BLANK,row5.getCell(3).getCellType());
  assertNull(row5.getCell(4));
  assertEquals(Cell.CELL_TYPE_BLANK,row6.getCell(1).getCellType());
  assertEquals(Cell.CELL_TYPE_BLANK,row6.getCell(2).getCellType());
  assertEquals(Cell.CELL_TYPE_BLANK,row6.getCell(3).getCellType());
  assertNull(row6.getCell(4));
  assertEquals(Cell.CELL_TYPE_BLANK,row7.getCell(1).getCellType());
  assertEquals(Cell.CELL_TYPE_BLANK,row7.getCell(2).getCellType());
  assertEquals(Cell.CELL_TYPE_BLANK,row7.getCell(3).getCellType());
  assertNull(row7.getCell(4));
  Cell cellB5=row5.getCell(1);
  CellValue valueB5=_evaluator.evaluate(cellB5);
  assertEquals(1,valueB5.getNumberValue(),0.0000000000000001);
  assertEquals(Cell.CELL_TYPE_NUMERIC,valueB5.getCellType());
  testToFormulaString(cellB5,"String_Node_Str");
  _evaluator.notifySetFormula(cellA10);
  valueA10=_evaluator.evaluate(cellA10);
  assertEquals(1,valueA10.getNumberValue(),0.0000000000000001);
  assertEquals(Cell.CELL_TYPE_NUMERIC,valueA10.getCellType());
  testToFormulaString(cellA10,"String_Node_Str");
  _evaluator.notifySetFormula(cellA12);
  valueA12=_evaluator.evaluate(cellA12);
  assertEquals(0,valueA12.getNumberValue(),0.0000000000000001);
  assertEquals(Cell.CELL_TYPE_NUMERIC,valueA12.getCellType());
  testToFormulaString(cellA12,"String_Node_Str");
  _evaluator.notifySetFormula(cellA11);
  valueA11=_evaluator.evaluate(cellA11);
  assertEquals(Cell.CELL_TYPE_ERROR,valueA11.getCellType());
  assertEquals(ErrorConstants.ERROR_REF,valueA11.getErrorValue());
}

Fixed version (ground truth):
@Test public void testMergeCells(){
  XSheet sheet1=_workbook.getWorksheet("String_Node_Str");
  Row row1=sheet1.getRow(0);
  Row row2=sheet1.getRow(1);
  Row row6=sheet1.getRow(5);
  Row row7=sheet1.getRow(6);
  Row row9=sheet1.getRow(8);
  Row row10=sheet1.getRow(9);
  Row row11=sheet1.getRow(10);
  Row row12=sheet1.getRow(11);
  assertEquals(Cell.CELL_TYPE_BLANK,row1.getCell(0).getCellType());
  assertEquals(Cell.CELL_TYPE_BLANK,row1.getCell(1).getCellType());
  assertNull(row1.getCell(2));
  assertEquals(Cell.CELL_TYPE_BLANK,row2.getCell(0).getCellType());
  assertEquals(Cell.CELL_TYPE_BLANK,row2.getCell(1).getCellType());
  assertNull(row2.getCell(2));
  assertEquals(1,row9.getCell(0).getNumericCellValue(),0.0000000000000001);
  assertEquals(2,row7.getCell(3).getNumericCellValue(),0.0000000000000001);
  assertNull(sheet1.getRow(4));
  Cell cellC6=row6.getCell(2);
  CellValue valueC6=_evaluator.evaluate(cellC6);
  assertEquals(1,valueC6.getNumberValue(),0.0000000000000001);
  assertEquals(Cell.CELL_TYPE_NUMERIC,valueC6.getCellType());
  testToFormulaString(cellC6,"String_Node_Str");
  Cell cellA10=row10.getCell(0);
  CellValue valueA10=_evaluator.evaluate(cellA10);
  assertEquals(1,valueA10.getNumberValue(),0.0000000000000001);
  assertEquals(Cell.CELL_TYPE_NUMERIC,valueA10.getCellType());
  testToFormulaString(cellA10,"String_Node_Str");
  Cell cellA11=row11.getCell(0);
  CellValue valueA11=_evaluator.evaluate(cellA11);
  assertEquals(0,valueA11.getNumberValue(),0.0000000000000001);
  assertEquals(Cell.CELL_TYPE_NUMERIC,valueA11.getCellType());
  testToFormulaString(cellA11,"String_Node_Str");
  Cell cellA12=row12.getCell(0);
  CellValue valueA12=_evaluator.evaluate(cellA12);
  assertEquals(2,valueA12.getNumberValue(),0.0000000000000001);
  assertEquals(Cell.CELL_TYPE_NUMERIC,valueA12.getCellType());
  testToFormulaString(cellA12,"String_Node_Str");
  BookHelper.merge(sheet1,4,1,6,3,false);
  Row row5=sheet1.getRow(4);
  assertEquals(Cell.CELL_TYPE_FORMULA,row5.getCell(1).getCellType());
  assertEquals(Cell.CELL_TYPE_BLANK,row5.getCell(2).getCellType());
  assertEquals(Cell.CELL_TYPE_BLANK,row5.getCell(3).getCellType());
  assertNull(row5.getCell(4));
  assertEquals(Cell.CELL_TYPE_BLANK,row6.getCell(1).getCellType());
  assertEquals(Cell.CELL_TYPE_BLANK,row6.getCell(2).getCellType());
  assertEquals(Cell.CELL_TYPE_BLANK,row6.getCell(3).getCellType());
  assertNull(row6.getCell(4));
  assertEquals(Cell.CELL_TYPE_BLANK,row7.getCell(1).getCellType());
  assertEquals(Cell.CELL_TYPE_BLANK,row7.getCell(2).getCellType());
  assertEquals(Cell.CELL_TYPE_BLANK,row7.getCell(3).getCellType());
  assertNull(row7.getCell(4));
  Cell cellB5=row5.getCell(1);
  CellValue valueB5=_evaluator.evaluate(cellB5);
  assertEquals(1,valueB5.getNumberValue(),0.0000000000000001);
  assertEquals(Cell.CELL_TYPE_NUMERIC,valueB5.getCellType());
  testToFormulaString(cellB5,"String_Node_Str");
  _evaluator.notifySetFormula(cellA10);
  valueA10=_evaluator.evaluate(cellA10);
  assertEquals(1,valueA10.getNumberValue(),0.0000000000000001);
  assertEquals(Cell.CELL_TYPE_NUMERIC,valueA10.getCellType());
  testToFormulaString(cellA10,"String_Node_Str");
  _evaluator.notifySetFormula(cellA12);
  valueA12=_evaluator.evaluate(cellA12);
  assertEquals(0,valueA12.getNumberValue(),0.0000000000000001);
  assertEquals(Cell.CELL_TYPE_NUMERIC,valueA12.getCellType());
  testToFormulaString(cellA12,"String_Node_Str");
  _evaluator.notifySetFormula(cellA11);
  valueA11=_evaluator.evaluate(cellA11);
  assertEquals(Cell.CELL_TYPE_ERROR,valueA11.getCellType());
  assertEquals(ErrorConstants.ERROR_REF,valueA11.getErrorValue());
}