@Test(expected = SuperCsvCellProcessorException.class) public void testWithNonCharInput() { processor.execute(1, ANONYMOUS_CSVCONTEXT); }
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final Character result; if( value instanceof Character ) { result = (Character) value; } else if( value instanceof String ) { final String stringValue = (String) value; if( stringValue.length() == 1 ) { result = Character.valueOf(stringValue.charAt(0)); } else { throw new SuperCsvCellProcessorException(String.format( "'%s' cannot be parsed as a char as it is a String longer than 1 character", stringValue), context, this); } } else { final String actualClassName = value.getClass().getName(); throw new SuperCsvCellProcessorException(String.format( "the input value should be of type Character or String but is of type %s", actualClassName), context, this); } return next.execute(result, context); }
ParseChar extends CellProcessorAdaptor implements StringCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final Character result; if( value instanceof Character ) { result = (Character) value; } else if( value instanceof String ) { final String stringValue = (String) value; if( stringValue.length() == 1 ) { result = Character.valueOf(stringValue.charAt(0)); } else { throw new SuperCsvCellProcessorException(String.format( "'%s' cannot be parsed as a char as it is a String longer than 1 character", stringValue), context, this); } } else { final String actualClassName = value.getClass().getName(); throw new SuperCsvCellProcessorException(String.format( "the input value should be of type Character or String but is of type %s", actualClassName), context, this); } return next.execute(result, context); } }
ParseChar extends CellProcessorAdaptor implements StringCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final Character result; if( value instanceof Character ) { result = (Character) value; } else if( value instanceof String ) { final String stringValue = (String) value; if( stringValue.length() == 1 ) { result = Character.valueOf(stringValue.charAt(0)); } else { throw new SuperCsvCellProcessorException(String.format( "'%s' cannot be parsed as a char as it is a String longer than 1 character", stringValue), context, this); } } else { final String actualClassName = value.getClass().getName(); throw new SuperCsvCellProcessorException(String.format( "the input value should be of type Character or String but is of type %s", actualClassName), context, this); } return next.execute(result, context); } ParseChar();  ParseChar(final DoubleCellProcessor next); }
ParseChar extends CellProcessorAdaptor implements StringCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final Character result; if( value instanceof Character ) { result = (Character) value; } else if( value instanceof String ) { final String stringValue = (String) value; if( stringValue.length() == 1 ) { result = Character.valueOf(stringValue.charAt(0)); } else { throw new SuperCsvCellProcessorException(String.format( "'%s' cannot be parsed as a char as it is a String longer than 1 character", stringValue), context, this); } } else { final String actualClassName = value.getClass().getName(); throw new SuperCsvCellProcessorException(String.format( "the input value should be of type Character or String but is of type %s", actualClassName), context, this); } return next.execute(result, context); } ParseChar();  ParseChar(final DoubleCellProcessor next); Object execute(final Object value, final CsvContext context); }
ParseChar extends CellProcessorAdaptor implements StringCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final Character result; if( value instanceof Character ) { result = (Character) value; } else if( value instanceof String ) { final String stringValue = (String) value; if( stringValue.length() == 1 ) { result = Character.valueOf(stringValue.charAt(0)); } else { throw new SuperCsvCellProcessorException(String.format( "'%s' cannot be parsed as a char as it is a String longer than 1 character", stringValue), context, this); } } else { final String actualClassName = value.getClass().getName(); throw new SuperCsvCellProcessorException(String.format( "the input value should be of type Character or String but is of type %s", actualClassName), context, this); } return next.execute(result, context); } ParseChar();  ParseChar(final DoubleCellProcessor next); Object execute(final Object value, final CsvContext context);  }