CellRangeAddress getRangeIfMerged( Cell cell,
                                       CellRangeAddress[] mergedRanges ) {
        for ( int i = 0; i < mergedRanges.length; i++ ) {
            CellRangeAddress r = mergedRanges[ i ];
            if ( r.isInRange( cell.getRowIndex(), cell.getColumnIndex() ) ) {
                return r;
            }
        }
        return null;
    }
@Test
    public void testCellMerge() throws Exception {
        ExcelParser parser = new ExcelParser((Map<String, List<DataListener>>) null);
        workbook = new XSSFWorkbook();
        sheet = workbook.createSheet();
        
        createCell(2, 2, FIRST_CELL_CONTENT);
        createCell(7, 5, LAST_CELL_VALUE);

        Cell cell = sheet.createRow(1).createCell(1);
        CellRangeAddress[] ranges = {new CellRangeAddress(2, 7, 2, 5)};
        assertThat(parser.getRangeIfMerged(cell, ranges)).isNull();
        
        updateCell(2,  5, "wrong");
        Cell wrongCell = getCell(2, 5);
        CellRangeAddress rangeIfMerged = parser.getRangeIfMerged(wrongCell, ranges);
        
        assertThat(sheet.getRow(rangeIfMerged.getFirstRow()).getCell(rangeIfMerged.getFirstColumn()).getStringCellValue()).isEqualTo(FIRST_CELL_CONTENT);
    }