@Test public void shouldSetCellsGivenDataList(){ Map<String, String> row1 = new HashMap<>(); row1.put("beginningBalance", "balanceX"); row1.put("quantityDispensed", "321"); Map<String, String> row2 = new HashMap<>(); row2.put("beginningBalance", "balanceY"); row2.put("quantityDispensed", "123"); List<Map<String, String>> dataList = new ArrayList<>(); dataList.add(row1); dataList.add(row2); util.createDataRows(tempSheet, dataList); assertThat(tempSheet.getRow(0).getCell(3).getStringCellValue(), is("BOP")); assertThat(tempSheet.getRow(1).getCell(0).getStringCellValue(), is("")); assertThat(tempSheet.getRow(1).getCell(3).getStringCellValue(), is("balanceX")); assertThat(tempSheet.getRow(1).getCell(4).getStringCellValue(), is("321")); assertThat(tempSheet.getRow(1).getCell(2).getStringCellValue(), is("TEXT")); assertThat(tempSheet.getRow(2).getCell(3).getStringCellValue(), is("balanceY")); assertThat(tempSheet.getRow(2).getCell(4).getStringCellValue(), is("123")); assertThat(tempSheet.getRow(2).getCell(2).getStringCellValue(), is("TEXT")); }
public void createDataRows(Sheet tempSheet, List<Map<String, String>> dataList) { Map<String, CellMeta> tempDataColumns = parseTemplateVariables(tempSheet); for (int l = 0; l < dataList.size(); l++) { Map<String, String> oneData = dataList.get(l); Row dataRow = tempSheet.createRow((l + 1)); for (Map.Entry<String, CellMeta> cellMetaEntry : tempDataColumns.entrySet()) { createRowCell(cellMetaEntry.getValue(), oneData, dataRow); } } }
SingleListSheetExcelHandler extends ExcelHandler { public void createDataRows(Sheet tempSheet, List<Map<String, String>> dataList) { Map<String, CellMeta> tempDataColumns = parseTemplateVariables(tempSheet); for (int l = 0; l < dataList.size(); l++) { Map<String, String> oneData = dataList.get(l); Row dataRow = tempSheet.createRow((l + 1)); for (Map.Entry<String, CellMeta> cellMetaEntry : tempDataColumns.entrySet()) { createRowCell(cellMetaEntry.getValue(), oneData, dataRow); } } } }
SingleListSheetExcelHandler extends ExcelHandler { public void createDataRows(Sheet tempSheet, List<Map<String, String>> dataList) { Map<String, CellMeta> tempDataColumns = parseTemplateVariables(tempSheet); for (int l = 0; l < dataList.size(); l++) { Map<String, String> oneData = dataList.get(l); Row dataRow = tempSheet.createRow((l + 1)); for (Map.Entry<String, CellMeta> cellMetaEntry : tempDataColumns.entrySet()) { createRowCell(cellMetaEntry.getValue(), oneData, dataRow); } } }  }
SingleListSheetExcelHandler extends ExcelHandler { public void createDataRows(Sheet tempSheet, List<Map<String, String>> dataList) { Map<String, CellMeta> tempDataColumns = parseTemplateVariables(tempSheet); for (int l = 0; l < dataList.size(); l++) { Map<String, String> oneData = dataList.get(l); Row dataRow = tempSheet.createRow((l + 1)); for (Map.Entry<String, CellMeta> cellMetaEntry : tempDataColumns.entrySet()) { createRowCell(cellMetaEntry.getValue(), oneData, dataRow); } } }  void createDataRows(Sheet tempSheet, List<Map<String, String>> dataList); Map<String, CellMeta> parseTemplateVariables(Sheet tempSheet); Cell createRowCell(CellMeta cellMeta, Map<String, String> data, Row dataRow); }
SingleListSheetExcelHandler extends ExcelHandler { public void createDataRows(Sheet tempSheet, List<Map<String, String>> dataList) { Map<String, CellMeta> tempDataColumns = parseTemplateVariables(tempSheet); for (int l = 0; l < dataList.size(); l++) { Map<String, String> oneData = dataList.get(l); Row dataRow = tempSheet.createRow((l + 1)); for (Map.Entry<String, CellMeta> cellMetaEntry : tempDataColumns.entrySet()) { createRowCell(cellMetaEntry.getValue(), oneData, dataRow); } } }  void createDataRows(Sheet tempSheet, List<Map<String, String>> dataList); Map<String, CellMeta> parseTemplateVariables(Sheet tempSheet); Cell createRowCell(CellMeta cellMeta, Map<String, String> data, Row dataRow);  }