### Question:
TableParser { public void parse(Component tableComponent) throws IOException, ResourceStreamNotFoundException, ParseException { try { BufferedWebResponse mockResponse = doRequest(tableComponent); doParse(mockResponse.getText(), tableComponent); } finally { afterParse(tableComponent); } } TableParser(Sheet sheet, CellExporter cellExporter); void parse(Component tableComponent); Sheet getSheet();  }### Answer:
@Test public void testTable1() throws IOException, ResourceStreamNotFoundException, ParseException { Sheet sheet = new HSSFWorkbook().createSheet(); TableParser tableParser = new TableParser(sheet, new GeneralPurposeExporter()); tableParser.parse(new Table1()); assertEquals(9, sheet.getLastRowNum()); assertEquals(3, sheet.getNumMergedRegions()); assertEquals(0, sheet.getMergedRegion(0).getFirstColumn()); assertEquals(1, sheet.getMergedRegion(0).getLastColumn()); assertEquals(3, sheet.getMergedRegion(0).getFirstRow()); assertEquals(3, sheet.getMergedRegion(0).getLastRow()); assertEquals(0, sheet.getMergedRegion(1).getFirstColumn()); assertEquals(0, sheet.getMergedRegion(1).getLastColumn()); assertEquals(4, sheet.getMergedRegion(1).getFirstRow()); assertEquals(5, sheet.getMergedRegion(1).getLastRow()); assertEquals(0, sheet.getMergedRegion(2).getFirstColumn()); assertEquals(2, sheet.getMergedRegion(2).getLastColumn()); assertEquals(6, sheet.getMergedRegion(2).getFirstRow()); assertEquals(6, sheet.getMergedRegion(2).getLastRow()); assertEquals("04/01/2000", sheet.getRow(3).getCell(2).getStringCellValue()); assertEquals("05/01/2000", sheet.getRow(4).getCell(2).getStringCellValue()); assertEquals("06/01/2000", sheet.getRow(5).getCell(2).getStringCellValue()); assertNull(sheet.getRow(6).getCell(2)); assertEquals("08/01/2000", sheet.getRow(7).getCell(2).getStringCellValue()); }
@Test public void testTable2() throws IOException, ResourceStreamNotFoundException, ParseException { Sheet sheet = new HSSFWorkbook().createSheet(); TableParser tableParser = new TableParser(sheet, new GeneralPurposeExporter()); tableParser.parse(new Table2()); assertEquals(0, sheet.getMergedRegion(0).getFirstColumn()); assertEquals(0, sheet.getMergedRegion(0).getLastColumn()); assertEquals(0, sheet.getMergedRegion(0).getFirstRow()); assertEquals(1, sheet.getMergedRegion(0).getLastRow()); assertEquals(1, sheet.getMergedRegion(1).getFirstColumn()); assertEquals(1, sheet.getMergedRegion(1).getLastColumn()); assertEquals(0, sheet.getMergedRegion(1).getFirstRow()); assertEquals(1, sheet.getMergedRegion(1).getLastRow()); assertEquals(2, sheet.getMergedRegion(2).getFirstColumn()); assertEquals(4, sheet.getMergedRegion(2).getLastColumn()); assertEquals(0, sheet.getMergedRegion(2).getFirstRow()); assertEquals(0, sheet.getMergedRegion(2).getLastRow()); assertEquals("3-1", sheet.getRow(1).getCell(2).getStringCellValue()); assertEquals("3-2", sheet.getRow(1).getCell(3).getStringCellValue()); assertEquals("3-3", sheet.getRow(1).getCell(4).getStringCellValue()); }