DelimitedRecordMapper extends AbstractRecordMapper<P> implements RecordMapper<String, P> { public void setQualifier(final String qualifier) { this.qualifier = qualifier; } DelimitedRecordMapper(final Class<P> recordClass);  DelimitedRecordMapper(final Class<P> recordClass, String... fieldNames);  DelimitedRecordMapper(final Class<P> recordClass, final String[] fieldNames, final int recordExpectedLength);  DelimitedRecordMapper(final Class<P> recordClass, final Integer... fieldsPositions);  DelimitedRecordMapper(final Class<P> recordClass, final Integer[] fieldsPositions, final String[] fieldNames);  DelimitedRecordMapper(final Class<P> recordClass, final Integer[] fieldsPositions, final String[] fieldNames, final int recordExpectedLength); @Override Record<P> processRecord(final Record<String> record); void setDelimiter(final String delimiter); void setTrimWhitespaces(final boolean trimWhitespaces); void setQualifier(final String qualifier); static final String DEFAULT_DELIMITER; static final String DEFAULT_QUALIFIER; static final boolean DEFAULT_WHITESPACE_TRIMMING; }
@Test public void testRecordParsingWithSimpleQuoteQualifier() throws Exception { delimitedRecordMapper.setQualifier("'"); when(record.getPayload()).thenReturn("'foo','bar','30','1990-12-12','true'"); validateRecord(record); }
@Test(expected = Exception.class) public void allFieldsShouldBeQualified() throws Exception { delimitedRecordMapper.setQualifier("'"); when(record.getPayload()).thenReturn("'foo','bar',30,'1990-12-12','true'"); validateRecord(record); }
@Test public void testRecordParsingWithDoubleQuoteQualifier() throws Exception { delimitedRecordMapper.setQualifier("\""); when(record.getPayload()).thenReturn("\"foo\",\"bar\",\"30\",\"1990-12-12\",\"true\""); validateRecord(record); }