@Test public void testProcessStringValue() throws Exception { assertNull(processStringValue(blankCell)); assertEquals("1.22", processStringValue(cellWithNumericString)); assertEquals("1.22", processStringValue(cellWithFloat)); }
public static String processStringValue(XSSFCell cell) { String stringValue = null; if (cell != null) { switch (cell.getCellType()) { case Cell.CELL_TYPE_STRING: stringValue = cell.getRichStringCellValue().getString().trim(); break; case Cell.CELL_TYPE_NUMERIC: stringValue = Double.toString(cell.getNumericCellValue()); break; default: throw new CellProcessingException("The field value cannot be converted"); } } return stringValue; }
SheetCellProcessingService { public static String processStringValue(XSSFCell cell) { String stringValue = null; if (cell != null) { switch (cell.getCellType()) { case Cell.CELL_TYPE_STRING: stringValue = cell.getRichStringCellValue().getString().trim(); break; case Cell.CELL_TYPE_NUMERIC: stringValue = Double.toString(cell.getNumericCellValue()); break; default: throw new CellProcessingException("The field value cannot be converted"); } } return stringValue; } }
SheetCellProcessingService { public static String processStringValue(XSSFCell cell) { String stringValue = null; if (cell != null) { switch (cell.getCellType()) { case Cell.CELL_TYPE_STRING: stringValue = cell.getRichStringCellValue().getString().trim(); break; case Cell.CELL_TYPE_NUMERIC: stringValue = Double.toString(cell.getNumericCellValue()); break; default: throw new CellProcessingException("The field value cannot be converted"); } } return stringValue; }  }
SheetCellProcessingService { public static String processStringValue(XSSFCell cell) { String stringValue = null; if (cell != null) { switch (cell.getCellType()) { case Cell.CELL_TYPE_STRING: stringValue = cell.getRichStringCellValue().getString().trim(); break; case Cell.CELL_TYPE_NUMERIC: stringValue = Double.toString(cell.getNumericCellValue()); break; default: throw new CellProcessingException("The field value cannot be converted"); } } return stringValue; }  static String processMandatoryStringValue(XSSFCell cell); static String processStringValue(XSSFCell cell); static Integer processIntValues(XSSFCell cell); static Float processFloatValues(XSSFCell cell); }
SheetCellProcessingService { public static String processStringValue(XSSFCell cell) { String stringValue = null; if (cell != null) { switch (cell.getCellType()) { case Cell.CELL_TYPE_STRING: stringValue = cell.getRichStringCellValue().getString().trim(); break; case Cell.CELL_TYPE_NUMERIC: stringValue = Double.toString(cell.getNumericCellValue()); break; default: throw new CellProcessingException("The field value cannot be converted"); } } return stringValue; }  static String processMandatoryStringValue(XSSFCell cell); static String processStringValue(XSSFCell cell); static Integer processIntValues(XSSFCell cell); static Float processFloatValues(XSSFCell cell);  }