### Question:
ExcelMetadataReader { public static ExcelMetadata instance( InputStream stream ) throws IOException { ExcelMetadata metadata = new ExcelMetadata(); HSSFWorkbook wb = new HSSFWorkbook(new POIFSFileSystem(stream)); StringBuffer buff = new StringBuffer(); List<String> sheets = new ArrayList<String>(); for (int sheetInd = 0; sheetInd < wb.getNumberOfSheets(); sheetInd++) { sheets.add(wb.getSheetName(sheetInd)); HSSFSheet worksheet = wb.getSheetAt(sheetInd); int lastRowNum = worksheet.getLastRowNum(); for (int rowNum = worksheet.getFirstRowNum(); rowNum <= lastRowNum; rowNum++) { HSSFRow row = worksheet.getRow(rowNum); if (row == null) { continue; } int lastCellNum = row.getLastCellNum(); for (int cellNum = row.getFirstCellNum(); cellNum < lastCellNum; cellNum++) { HSSFCell cell = row.getCell(cellNum); switch (cell.getCellType()) { case HSSFCell.CELL_TYPE_STRING: buff.append(cell.getRichStringCellValue().getString()); break; case HSSFCell.CELL_TYPE_NUMERIC: buff.append(cell.getNumericCellValue()); break; case HSSFCell.CELL_TYPE_FORMULA: buff.append(cell.getCellFormula()); break; } HSSFComment comment = cell.getCellComment(); if (comment != null) { String commentText = comment.getString().getString().replace(ROW_DELIMITER_CHAR, ' '); buff.append(" ["); buff.append(commentText); buff.append(" by "); buff.append(comment.getAuthor()); buff.append(']'); } if (cellNum < lastCellNum - 1) { buff.append(CELL_DELIMITER_CHAR); } else { buff.append(ROW_DELIMITER_CHAR); } } } } metadata.setText(buff.toString()); metadata.setSheets(sheets); return metadata; }  static ExcelMetadata instance( InputStream stream );  }### Answer:
@Test public void shouldBeAbleToCreateMetadataForExcel() throws Exception { excelReader = ExcelMetadataReader.instance(this.getTestDocument("excel.xls")); assertThat(excelReader.getSheets().contains("MySheet2"), is(true)); assertThat(excelReader.getText().startsWith("This is a text"), is(true)); }