@Test(expected = SuperCsvCellProcessorException.class) public void testWithInvalidDateFormat() { CellProcessor invalidDateFormatProcessor = new FmtSqlTime("abcd"); invalidDateFormatProcessor.execute(TIME, ANONYMOUS_CSVCONTEXT); }
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !(value instanceof Time) ) { throw new SuperCsvCellProcessorException(Time.class, value, context, this); } final SimpleDateFormat formatter; try { formatter = new SimpleDateFormat(dateFormat); } catch(IllegalArgumentException e) { throw new SuperCsvCellProcessorException(String.format("'%s' is not a valid date format", dateFormat), context, this, e); } String result = formatter.format((Time) value); return next.execute(result, context); }
FmtSqlTime extends CellProcessorAdaptor implements DateCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !(value instanceof Time) ) { throw new SuperCsvCellProcessorException(Time.class, value, context, this); } final SimpleDateFormat formatter; try { formatter = new SimpleDateFormat(dateFormat); } catch(IllegalArgumentException e) { throw new SuperCsvCellProcessorException(String.format("'%s' is not a valid date format", dateFormat), context, this, e); } String result = formatter.format((Time) value); return next.execute(result, context); } }
FmtSqlTime extends CellProcessorAdaptor implements DateCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !(value instanceof Time) ) { throw new SuperCsvCellProcessorException(Time.class, value, context, this); } final SimpleDateFormat formatter; try { formatter = new SimpleDateFormat(dateFormat); } catch(IllegalArgumentException e) { throw new SuperCsvCellProcessorException(String.format("'%s' is not a valid date format", dateFormat), context, this, e); } String result = formatter.format((Time) value); return next.execute(result, context); } FmtSqlTime(final String dateFormat);  FmtSqlTime(final String dateFormat, final StringCellProcessor next); }
FmtSqlTime extends CellProcessorAdaptor implements DateCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !(value instanceof Time) ) { throw new SuperCsvCellProcessorException(Time.class, value, context, this); } final SimpleDateFormat formatter; try { formatter = new SimpleDateFormat(dateFormat); } catch(IllegalArgumentException e) { throw new SuperCsvCellProcessorException(String.format("'%s' is not a valid date format", dateFormat), context, this, e); } String result = formatter.format((Time) value); return next.execute(result, context); } FmtSqlTime(final String dateFormat);  FmtSqlTime(final String dateFormat, final StringCellProcessor next); Object execute(final Object value, final CsvContext context); }
FmtSqlTime extends CellProcessorAdaptor implements DateCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !(value instanceof Time) ) { throw new SuperCsvCellProcessorException(Time.class, value, context, this); } final SimpleDateFormat formatter; try { formatter = new SimpleDateFormat(dateFormat); } catch(IllegalArgumentException e) { throw new SuperCsvCellProcessorException(String.format("'%s' is not a valid date format", dateFormat), context, this, e); } String result = formatter.format((Time) value); return next.execute(result, context); } FmtSqlTime(final String dateFormat);  FmtSqlTime(final String dateFormat, final StringCellProcessor next); Object execute(final Object value, final CsvContext context);  }