@Test public void testNullInput() { for (CellProcessor p : processors) { try { p.execute(null, ANONYMOUS_CSVCONTEXT); fail("expecting SuperCsvCellProcessorException"); } catch (SuperCsvCellProcessorException e) { assertEquals( "this processor does not accept null input - " + "if the column is optional then chain an Optional() processor before this one", e.getMessage()); } } }
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if (!(value instanceof String)) { throw new SuperCsvCellProcessorException(String.class, value, context, this); } final String string = (String) value; final Period result; try { if (formatter != null) { result = Period.parse(string, formatter); } else { result = Period.parse(string); } } catch (IllegalArgumentException e) { throw new SuperCsvCellProcessorException( "Failed to parse value as a Period", context, this, e); } return next.execute(result, context); }
ParsePeriod extends CellProcessorAdaptor implements StringCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if (!(value instanceof String)) { throw new SuperCsvCellProcessorException(String.class, value, context, this); } final String string = (String) value; final Period result; try { if (formatter != null) { result = Period.parse(string, formatter); } else { result = Period.parse(string); } } catch (IllegalArgumentException e) { throw new SuperCsvCellProcessorException( "Failed to parse value as a Period", context, this, e); } return next.execute(result, context); } }
ParsePeriod extends CellProcessorAdaptor implements StringCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if (!(value instanceof String)) { throw new SuperCsvCellProcessorException(String.class, value, context, this); } final String string = (String) value; final Period result; try { if (formatter != null) { result = Period.parse(string, formatter); } else { result = Period.parse(string); } } catch (IllegalArgumentException e) { throw new SuperCsvCellProcessorException( "Failed to parse value as a Period", context, this, e); } return next.execute(result, context); } ParsePeriod();  ParsePeriod(final CellProcessor next);  ParsePeriod(final PeriodFormatter formatter);  ParsePeriod(final PeriodFormatter formatter, final CellProcessor next); }
ParsePeriod extends CellProcessorAdaptor implements StringCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if (!(value instanceof String)) { throw new SuperCsvCellProcessorException(String.class, value, context, this); } final String string = (String) value; final Period result; try { if (formatter != null) { result = Period.parse(string, formatter); } else { result = Period.parse(string); } } catch (IllegalArgumentException e) { throw new SuperCsvCellProcessorException( "Failed to parse value as a Period", context, this, e); } return next.execute(result, context); } ParsePeriod();  ParsePeriod(final CellProcessor next);  ParsePeriod(final PeriodFormatter formatter);  ParsePeriod(final PeriodFormatter formatter, final CellProcessor next); Object execute(final Object value, final CsvContext context); }
ParsePeriod extends CellProcessorAdaptor implements StringCellProcessor { public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if (!(value instanceof String)) { throw new SuperCsvCellProcessorException(String.class, value, context, this); } final String string = (String) value; final Period result; try { if (formatter != null) { result = Period.parse(string, formatter); } else { result = Period.parse(string); } } catch (IllegalArgumentException e) { throw new SuperCsvCellProcessorException( "Failed to parse value as a Period", context, this, e); } return next.execute(result, context); } ParsePeriod();  ParsePeriod(final CellProcessor next);  ParsePeriod(final PeriodFormatter formatter);  ParsePeriod(final PeriodFormatter formatter, final CellProcessor next); Object execute(final Object value, final CsvContext context);  }