@Test public void testInvalidProcessIntValues() throws Exception { exception.expect(CellProcessingException.class); exception.expectMessage(containsString("The field must be a Number")); processIntValues(cellWithString); processIntValues(blankCell); }
public static Integer processIntValues(XSSFCell cell) { Integer intValue = null; if (cell != null) { switch (cell.getCellType()) { case Cell.CELL_TYPE_NUMERIC: Long roundedValue = Math.round(cell.getNumericCellValue()); intValue = roundedValue.intValue(); break; default: throw new CellProcessingException("The field must be a Number"); } } return intValue; }
SheetCellProcessingService { public static Integer processIntValues(XSSFCell cell) { Integer intValue = null; if (cell != null) { switch (cell.getCellType()) { case Cell.CELL_TYPE_NUMERIC: Long roundedValue = Math.round(cell.getNumericCellValue()); intValue = roundedValue.intValue(); break; default: throw new CellProcessingException("The field must be a Number"); } } return intValue; } }
SheetCellProcessingService { public static Integer processIntValues(XSSFCell cell) { Integer intValue = null; if (cell != null) { switch (cell.getCellType()) { case Cell.CELL_TYPE_NUMERIC: Long roundedValue = Math.round(cell.getNumericCellValue()); intValue = roundedValue.intValue(); break; default: throw new CellProcessingException("The field must be a Number"); } } return intValue; }  }
SheetCellProcessingService { public static Integer processIntValues(XSSFCell cell) { Integer intValue = null; if (cell != null) { switch (cell.getCellType()) { case Cell.CELL_TYPE_NUMERIC: Long roundedValue = Math.round(cell.getNumericCellValue()); intValue = roundedValue.intValue(); break; default: throw new CellProcessingException("The field must be a Number"); } } return intValue; }  static String processMandatoryStringValue(XSSFCell cell); static String processStringValue(XSSFCell cell); static Integer processIntValues(XSSFCell cell); static Float processFloatValues(XSSFCell cell); }
SheetCellProcessingService { public static Integer processIntValues(XSSFCell cell) { Integer intValue = null; if (cell != null) { switch (cell.getCellType()) { case Cell.CELL_TYPE_NUMERIC: Long roundedValue = Math.round(cell.getNumericCellValue()); intValue = roundedValue.intValue(); break; default: throw new CellProcessingException("The field must be a Number"); } } return intValue; }  static String processMandatoryStringValue(XSSFCell cell); static String processStringValue(XSSFCell cell); static Integer processIntValues(XSSFCell cell); static Float processFloatValues(XSSFCell cell);  }