From b9a7913fb63a8b3c73ef2c97e579ba2fc169140b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 16 Mar 2021 11:30:28 +0000 Subject: [PATCH 1/2] Bump junit from 4.12 to 4.13.1 Bumps [junit](https://github.com/junit-team/junit4) from 4.12 to 4.13.1. - [Release notes](https://github.com/junit-team/junit4/releases) - [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.12.md) - [Commits](https://github.com/junit-team/junit4/compare/r4.12...r4.13.1) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c469d87..0eeba8d 100644 --- a/pom.xml +++ b/pom.xml @@ -219,7 +219,7 @@ junit junit - 4.12 + 4.13.1 From 3aaa732cf2007bf155cc64bb6b9a095800e5ded8 Mon Sep 17 00:00:00 2001 From: George Petrov Date: Mon, 21 Feb 2022 08:15:18 -0500 Subject: [PATCH 2/2] Updated org.apache.poi version to 5.0.0 --- pom.xml | 2 +- .../easytest/loader/ExcelDataLoader.java | 30 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index c469d87..10a77bb 100644 --- a/pom.xml +++ b/pom.xml @@ -294,7 +294,7 @@ org.apache.poi poi - 3.8 + 5.0.0 diff --git a/src/main/java/org/easetech/easytest/loader/ExcelDataLoader.java b/src/main/java/org/easetech/easytest/loader/ExcelDataLoader.java index 1c81ce2..9bcff6e 100644 --- a/src/main/java/org/easetech/easytest/loader/ExcelDataLoader.java +++ b/src/main/java/org/easetech/easytest/loader/ExcelDataLoader.java @@ -25,6 +25,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.apache.poi.ss.usermodel.CellType.*; + /** * An implementation of {@link Loader} for the EXCEL(xls) based files. This Loader is responsible for reading a list of * xls based files and converting them into a data structure which is understandable by the EasyTest framework. It @@ -225,15 +227,15 @@ private Map nullValueMap(Map tempObject){ private Object objectFrom(final HSSFWorkbook workbook, final Cell cell) { Object cellValue = null; - if (cell == null || cell.getCellType() == Cell.CELL_TYPE_BLANK) { + if (cell == null || cell.getCellType() == BLANK) { cellValue = null; - } else if (cell.getCellType() == Cell.CELL_TYPE_STRING) { + } else if (cell.getCellType() == STRING) { cellValue = cell.getRichStringCellValue().getString(); - } else if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) { + } else if (cell.getCellType() == NUMERIC) { cellValue = getNumericCellValue(cell); - } else if (cell.getCellType() == Cell.CELL_TYPE_BOOLEAN) { + } else if (cell.getCellType() == BOOLEAN) { cellValue = cell.getBooleanCellValue(); - } else if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) { + } else if (cell.getCellType() == FORMULA) { cellValue = evaluateCellFormula(workbook, cell); } @@ -273,11 +275,11 @@ private Object evaluateCellFormula(final HSSFWorkbook workbook, final Cell cell) CellValue cellValue = evaluator.evaluate(cell); Object result = null; - if (cellValue.getCellType() == Cell.CELL_TYPE_BOOLEAN) { + if (cellValue.getCellType() == BOOLEAN) { result = cellValue.getBooleanValue(); - } else if (cellValue.getCellType() == Cell.CELL_TYPE_NUMERIC) { + } else if (cellValue.getCellType() == NUMERIC) { result = cellValue.getNumberValue(); - } else if (cellValue.getCellType() == Cell.CELL_TYPE_STRING) { + } else if (cellValue.getCellType() == STRING) { result = cellValue.getStringValue(); } @@ -460,22 +462,22 @@ private void writeDataToCell(Sheet sheet, int rowNum, int columnNum, Object valu } if (value instanceof String) { - cell.setCellType(Cell.CELL_TYPE_STRING); + cell.setCellType(STRING); cell.setCellValue((String)trimActualResult(value.toString())); } else if (value instanceof Double) { - cell.setCellType(Cell.CELL_TYPE_NUMERIC); + cell.setCellType(NUMERIC); cell.setCellValue((Double) value); } else if (value instanceof Integer) { - cell.setCellType(Cell.CELL_TYPE_NUMERIC); + cell.setCellType(NUMERIC); cell.setCellValue((Integer) value); } else if (value instanceof Long) { - cell.setCellType(Cell.CELL_TYPE_NUMERIC); + cell.setCellType(NUMERIC); cell.setCellValue((Long) value); } else if (value instanceof Float) { - cell.setCellType(Cell.CELL_TYPE_NUMERIC); + cell.setCellType(NUMERIC); cell.setCellValue((Float) value); } else if (value != null) { - cell.setCellType(Cell.CELL_TYPE_STRING); + cell.setCellType(STRING); cell.setCellValue((String)trimActualResult(value.toString())); } }