### Question:
CSVDataSource extends ColumnarDataSource { public void setHeaderLine(boolean hasheader) { this.hasheader = hasheader; } CSVDataSource(); String getInputFile(); void setInputFile(String file); String getEncoding(); void setEncoding(String encoding); int getSkipLines(); void setSkipLines(int skiplines); boolean getHeaderLine(); void setHeaderLine(boolean hasheader); char getSeparator(); void setSeparator(char separator); int getBufferSize(); void setBufferSize(int buffer_size); void setReader(Reader reader); RecordIterator getRecords(); @Override void writeConfig(ConfigWriter cw);  }### Answer:
@Test public void testSingleRecordWithoutHeader() throws IOException { source.addColumn(new Column("1", "F1", null, null)); source.addColumn(new Column("2", "F2", null, null)); source.addColumn(new Column("3", "F3", null, null)); source.setHeaderLine(false); RecordIterator it = read("a,b,c"); Record r = it.next(); assertEquals("a", r.getValue("F1")); assertEquals("b", r.getValue("F2")); assertEquals("c", r.getValue("F3")); }
@Test public void testSingleRecordWithoutHeaderExtraColumn() throws IOException { source.addColumn(new Column("1", "F1", null, null)); source.addColumn(new Column("2", "F2", null, null)); source.addColumn(new Column("3", "F3", null, null)); source.setHeaderLine(false); RecordIterator it = read("a,b,c,d"); Record r = it.next(); assertEquals("a", r.getValue("F1")); assertEquals("b", r.getValue("F2")); assertEquals("c", r.getValue("F3")); }
@Test public void testSingleRecordWithoutHeaderSkipColumn() throws IOException { source.addColumn(new Column("1", "F1", null, null)); source.addColumn(new Column("3", "F3", null, null)); source.setHeaderLine(false); RecordIterator it = read("a,b,c"); Record r = it.next(); assertEquals("a", r.getValue("F1")); assertEquals(null, r.getValue("F2")); assertEquals("c", r.getValue("F3")); }