@Test(expected = SuperCsvCellProcessorException.class) public void testWithNonIntInput() { processor.execute(1.23, ANONYMOUS_CSVCONTEXT); }
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final Integer result; if( value instanceof Integer ) { result = (Integer) value; } else if( value instanceof String ) { try { result = Integer.valueOf((String) value); } catch(final NumberFormatException e) { throw new SuperCsvCellProcessorException( String.format("'%s' could not be parsed as an Integer", value), context, this, 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); } return next.execute(result, context); }
ParseInt extends CellProcessorAdaptor implements StringCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final Integer result; if( value instanceof Integer ) { result = (Integer) value; } else if( value instanceof String ) { try { result = Integer.valueOf((String) value); } catch(final NumberFormatException e) { throw new SuperCsvCellProcessorException( String.format("'%s' could not be parsed as an Integer", value), context, this, 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); } return next.execute(result, context); } }
ParseInt extends CellProcessorAdaptor implements StringCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final Integer result; if( value instanceof Integer ) { result = (Integer) value; } else if( value instanceof String ) { try { result = Integer.valueOf((String) value); } catch(final NumberFormatException e) { throw new SuperCsvCellProcessorException( String.format("'%s' could not be parsed as an Integer", value), context, this, 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); } return next.execute(result, context); } ParseInt();  ParseInt(final LongCellProcessor next); }
ParseInt extends CellProcessorAdaptor implements StringCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final Integer result; if( value instanceof Integer ) { result = (Integer) value; } else if( value instanceof String ) { try { result = Integer.valueOf((String) value); } catch(final NumberFormatException e) { throw new SuperCsvCellProcessorException( String.format("'%s' could not be parsed as an Integer", value), context, this, 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); } return next.execute(result, context); } ParseInt();  ParseInt(final LongCellProcessor next); Object execute(final Object value, final CsvContext context); }
ParseInt extends CellProcessorAdaptor implements StringCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final Integer result; if( value instanceof Integer ) { result = (Integer) value; } else if( value instanceof String ) { try { result = Integer.valueOf((String) value); } catch(final NumberFormatException e) { throw new SuperCsvCellProcessorException( String.format("'%s' could not be parsed as an Integer", value), context, this, 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); } return next.execute(result, context); } ParseInt();  ParseInt(final LongCellProcessor next); Object execute(final Object value, final CsvContext context);  }