@Test public void shouldParseInteger() throws Exception { parseIntegerFromDouble.execute("999", context); verify(next).execute(argThat(parsedValueMatcher(999)), eq(context)); }
@Override public Object execute(Object value, CsvContext context) { validateInputNotNull(value, context); Integer result; if (value instanceof Integer) { result = (Integer) value; } else if (value instanceof String) { String stringValue = (String) value; try { result = Integer.valueOf(stringValue); } catch (final NumberFormatException e) { result = parseIntegerPart(value, context, stringValue, e); } } else { final String actualClassName = value.getClass().getName(); throw new SuperCsvCellProcessorException(String.format( "the input value should be of type Integer or String but is of type %s", actualClassName), context, this); } final Integer finalResult = result; return next.execute(finalResult, context); }
ParseIntegerFromDouble extends CellProcessorAdaptor implements StringCellProcessor { @Override public Object execute(Object value, CsvContext context) { validateInputNotNull(value, context); Integer result; if (value instanceof Integer) { result = (Integer) value; } else if (value instanceof String) { String stringValue = (String) value; try { result = Integer.valueOf(stringValue); } catch (final NumberFormatException e) { result = parseIntegerPart(value, context, stringValue, e); } } else { final String actualClassName = value.getClass().getName(); throw new SuperCsvCellProcessorException(String.format( "the input value should be of type Integer or String but is of type %s", actualClassName), context, this); } final Integer finalResult = result; return next.execute(finalResult, context); } }
ParseIntegerFromDouble extends CellProcessorAdaptor implements StringCellProcessor { @Override public Object execute(Object value, CsvContext context) { validateInputNotNull(value, context); Integer result; if (value instanceof Integer) { result = (Integer) value; } else if (value instanceof String) { String stringValue = (String) value; try { result = Integer.valueOf(stringValue); } catch (final NumberFormatException e) { result = parseIntegerPart(value, context, stringValue, e); } } else { final String actualClassName = value.getClass().getName(); throw new SuperCsvCellProcessorException(String.format( "the input value should be of type Integer or String but is of type %s", actualClassName), context, this); } final Integer finalResult = result; return next.execute(finalResult, context); } ParseIntegerFromDouble();  ParseIntegerFromDouble(CellProcessor next); }
ParseIntegerFromDouble extends CellProcessorAdaptor implements StringCellProcessor { @Override public Object execute(Object value, CsvContext context) { validateInputNotNull(value, context); Integer result; if (value instanceof Integer) { result = (Integer) value; } else if (value instanceof String) { String stringValue = (String) value; try { result = Integer.valueOf(stringValue); } catch (final NumberFormatException e) { result = parseIntegerPart(value, context, stringValue, e); } } else { final String actualClassName = value.getClass().getName(); throw new SuperCsvCellProcessorException(String.format( "the input value should be of type Integer or String but is of type %s", actualClassName), context, this); } final Integer finalResult = result; return next.execute(finalResult, context); } ParseIntegerFromDouble();  ParseIntegerFromDouble(CellProcessor next); @Override Object execute(Object value, CsvContext context); }
ParseIntegerFromDouble extends CellProcessorAdaptor implements StringCellProcessor { @Override public Object execute(Object value, CsvContext context) { validateInputNotNull(value, context); Integer result; if (value instanceof Integer) { result = (Integer) value; } else if (value instanceof String) { String stringValue = (String) value; try { result = Integer.valueOf(stringValue); } catch (final NumberFormatException e) { result = parseIntegerPart(value, context, stringValue, e); } } else { final String actualClassName = value.getClass().getName(); throw new SuperCsvCellProcessorException(String.format( "the input value should be of type Integer or String but is of type %s", actualClassName), context, this); } final Integer finalResult = result; return next.execute(finalResult, context); } ParseIntegerFromDouble();  ParseIntegerFromDouble(CellProcessor next); @Override Object execute(Object value, CsvContext context); static final String DECIMAl_POINT; }