Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13.1</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -294,7 +294,7 @@
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.8</version>
<version>5.0.0</version>
</dependency>

<dependency>
Expand Down
30 changes: 16 additions & 14 deletions src/main/java/org/easetech/easytest/loader/ExcelDataLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -225,15 +227,15 @@ private Map<String,Object> nullValueMap(Map<Integer , Object> 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);
}

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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()));
}
}
Expand Down