### Question:
CsvInputFormat extends GenericCsvInputFormat<OUT> { @Override public void open(FileInputSplit split) throws IOException { super.open(split); @SuppressWarnings("unchecked") FieldParser<Object>[] fieldParsers = (FieldParser<Object>[]) getFieldParsers(); if (fieldParsers.length == 0) { throw new IOException("CsvInputFormat.open(FileInputSplit split) - no field parsers to parse input"); } this.parsedValues = new Object[fieldParsers.length]; for (int i = 0; i < fieldParsers.length; i++) { this.parsedValues[i] = fieldParsers[i].createValue(); } if (this.getDelimiter().length == 1 && this.getDelimiter()[0] == '\n' ) { this.lineDelimiterIsLinebreak = true; } } CsvInputFormat(Path filePath);  CsvInputFormat(Path filePath, Class<?> ... types);  CsvInputFormat(Path filePath, String lineDelimiter, char fieldDelimiter, Class<?>... types); void setFieldTypes(Class<?> ... fieldTypes); void setFields(int[] sourceFieldIndices, Class<?>[] fieldTypes); void setFields(boolean[] sourceFieldMask, Class<?>[] fieldTypes); Class<?>[] getFieldTypes(); @Override void open(FileInputSplit split); @Override OUT readRecord(OUT reuse, byte[] bytes, int offset, int numBytes); @Override String toString(); static final String DEFAULT_LINE_DELIMITER; static final char DEFAULT_FIELD_DELIMITER; }### Answer:
@Test public void readStringFields() { try { final String fileContent = "abc|def|ghijk\nabc||hhg\n|||"; final FileInputSplit split = createTempFile(fileContent); final CsvInputFormat<Tuple3<String, String, String>> format = new CsvInputFormat<Tuple3<String, String, String>>(PATH, "\n", '|', String.class, String.class, String.class); final Configuration parameters = new Configuration(); format.configure(parameters); format.open(split); Tuple3<String, String, String> result = new Tuple3<String, String, String>(); result = format.nextRecord(result); assertNotNull(result); assertEquals("abc", result.f0); assertEquals("def", result.f1); assertEquals("ghijk", result.f2); result = format.nextRecord(result); assertNotNull(result); assertEquals("abc", result.f0); assertEquals("", result.f1); assertEquals("hhg", result.f2); result = format.nextRecord(result); assertNotNull(result); assertEquals("", result.f0); assertEquals("", result.f1); assertEquals("", result.f2); result = format.nextRecord(result); assertNull(result); assertTrue(format.reachedEnd()); } catch (Exception ex) { ex.printStackTrace(); fail("Test failed due to a " + ex.getClass().getName() + ": " + ex.getMessage()); } }