@Test public void testReadExcelFile() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); createWorkbook(outputStream); inputStream = new ByteArrayInputStream(outputStream.toByteArray()); ExcelFileReader excelFileReader = new ExcelFileReader(mockStore, excelFileDescriptor, inputStream); excelFileReader.read(); assertEquals(1, sheets.size()); assertEquals(1, rows.size()); assertEquals(4, cells.size()); verify(excelSheetDescriptor).setName("Employee"); verify(excelCellDescriptor).setStringValue("Name"); verify(excelCellDescriptor).setStringValue("Email"); verify(excelCellDescriptor).setStringValue("Date Of Birth"); verify(excelCellDescriptor).setStringValue("Salary"); }
void read() throws IOException { try(Workbook workbook = WorkbookFactory.create(inputStream)) { for (Sheet sheet : workbook) { readSheet(sheet); } } }
ExcelFileReader { void read() throws IOException { try(Workbook workbook = WorkbookFactory.create(inputStream)) { for (Sheet sheet : workbook) { readSheet(sheet); } } } }
ExcelFileReader { void read() throws IOException { try(Workbook workbook = WorkbookFactory.create(inputStream)) { for (Sheet sheet : workbook) { readSheet(sheet); } } } ExcelFileReader(Store store, ExcelFileDescriptor excelFileDescriptor, InputStream inputStream); }
ExcelFileReader { void read() throws IOException { try(Workbook workbook = WorkbookFactory.create(inputStream)) { for (Sheet sheet : workbook) { readSheet(sheet); } } } ExcelFileReader(Store store, ExcelFileDescriptor excelFileDescriptor, InputStream inputStream);  }
ExcelFileReader { void read() throws IOException { try(Workbook workbook = WorkbookFactory.create(inputStream)) { for (Sheet sheet : workbook) { readSheet(sheet); } } } ExcelFileReader(Store store, ExcelFileDescriptor excelFileDescriptor, InputStream inputStream);   }