### Question:
ExcelRead { public static <E> void read(InputStream inputStream, ExcelReadDeal<E> deal) { Objects.requireNonNull(inputStream); Objects.requireNonNull(deal); try (Workbook wb = WorkbookFactory.create(inputStream)) { for (int i = 0; i < wb.getNumberOfSheets(); i++) { Sheet sheet = wb.getSheetAt(i); if (null == sheet) { continue; } int tmp = deal.getBatchCount(); int index = 0; List<E> l = new ArrayList<>(tmp); for (Row row : sheet) { ++index; if (index <= deal.skipLine()) { continue; } E o = deal.dealBean(row); if (null != o) { l.add(o); if (index % tmp == 0) { deal.dealBatchBean(l); l = new ArrayList<>(tmp); } } } if (!l.isEmpty()) { deal.dealBatchBean(l); } } } catch (Exception e) { e.printStackTrace(); } finally { try { inputStream.close(); } catch (IOException e) { inputStream = null; } } }  static void read(InputStream inputStream, ExcelReadDeal<E> deal);  }### Answer:
@Test public void testRead() { ExcelRead.read(ExcelReadTest.class.getResourceAsStream("/a.xls"), new ExcelReadDeal<ExcelReadDto>() { @Override public ExcelReadDto dealBean(Row row) { ExcelReadDto dto = new ExcelReadDto(); dto.setId(new BigDecimal(row.getCell(0).toString()).longValue()); dto.setName(row.getCell(1).toString()); dto.setAge(Integer.valueOf(row.getCell(2).toString())); return dto; } @Override public void dealBatchBean(List<ExcelReadDto> list) { Assert.assertEquals("name1", list.get(0).getName()); Assert.assertEquals("name2", list.get(1).getName()); Assert.assertEquals("name3", list.get(2).getName()); } }); }