### Question:
QuotedLineBreakAccessor extends HdfsAtomicDataAccessor { @Override public OneRow readNextObject() throws IOException { if (super.readNextObject() == null) { return null; } String nextLine = readLine(); if (nextLine == null) { return null; } if (fileAsRow) { nextLine = context.getGreenplumCSV().toCsvField(nextLine, firstLine, lastLine); firstLine = false; } return new OneRow(null, nextLine); }  @Override void initialize(RequestContext requestContext); @Override boolean openForRead(); @Override OneRow readNextObject(); @Override boolean openForWrite(); @Override boolean writeNextObject(OneRow onerow); @Override void closeForWrite();  }### Answer:
@Test public void testReadFromEmptyFile() throws Exception { prepareTest("csv/empty.csv", false); OneRow oneRow = accessor.readNextObject(); assertNull(oneRow); }
@Test public void testReadFromEmptyFileFileAsRow() throws Exception { prepareTest("csv/empty.csv", true); OneRow oneRow = accessor.readNextObject(); assertNull(oneRow); }
@Test public void testReadFromSingleLineCsvFile() throws Exception { prepareTest("csv/singleline.csv", false); OneRow oneRow = accessor.readNextObject(); assertNotNull(oneRow); assertEquals("a,b,c", oneRow.getData()); oneRow = accessor.readNextObject(); assertNull(oneRow); }
@Test public void testReadFromSingleLineCsvFileFileAsRow() throws Exception { prepareTest("csv/singleline.csv", true); OneRow oneRow = accessor.readNextObject(); assertNotNull(oneRow); assertEquals("\"a,b,c\"", oneRow.getData()); oneRow = accessor.readNextObject(); assertNull(oneRow); }
@Test public void testReadFromSimpleCsvFile() throws Exception { prepareTest("csv/simple.csv", false); OneRow oneRow = accessor.readNextObject(); assertNotNull(oneRow); assertEquals("1,a,b", oneRow.getData()); oneRow = accessor.readNextObject(); assertNotNull(oneRow); assertEquals("2,c,d", oneRow.getData()); oneRow = accessor.readNextObject(); assertNotNull(oneRow); assertEquals("3,e,f", oneRow.getData()); oneRow = accessor.readNextObject(); assertNull(oneRow); }
@Test public void testReadFromSimpleCsvFileFileAsRow() throws Exception { prepareTest("csv/simple.csv", true); OneRow oneRow = accessor.readNextObject(); assertNotNull(oneRow); assertEquals("\"1,a,b", oneRow.getData()); oneRow = accessor.readNextObject(); assertNotNull(oneRow); assertEquals("2,c,d", oneRow.getData()); oneRow = accessor.readNextObject(); assertNotNull(oneRow); assertEquals("3,e,f\"", oneRow.getData()); oneRow = accessor.readNextObject(); assertNull(oneRow); }
@Test public void testReadFromQuotedCsvFile() throws Exception { prepareTest("csv/quoted.csv", false); OneRow oneRow = accessor.readNextObject(); assertNotNull(oneRow); assertEquals("\"1\",\"2", oneRow.getData()); oneRow = accessor.readNextObject(); assertNotNull(oneRow); assertEquals("and 3\",\"4\"", oneRow.getData()); oneRow = accessor.readNextObject(); assertNull(oneRow); }
@Test public void testReadFromQuotedCsvFileFileAsRow() throws Exception { prepareTest("csv/quoted.csv", true); OneRow oneRow = accessor.readNextObject(); assertNotNull(oneRow); assertEquals("\"\"\"1\"\",\"\"2", oneRow.getData()); oneRow = accessor.readNextObject(); assertNotNull(oneRow); assertEquals("and 3\"\",\"\"4\"\"\"", oneRow.getData()); oneRow = accessor.readNextObject(); assertNull(oneRow); }