CsvWriter extends Writer { public void writeRecord(String... values) throws IOException { for (int i = 0; i < values.length; i++) { String value = values[i]; if (i > 0) { write(separator); } write(value); } write("\n"); } CsvWriter(Writer out, String separator); void writeRecord(String... values); void writeRecord(double... values); @Override void write(char[] cbuf, int off, int len); @Override void flush(); @Override void close();  }
@Test public void testWriteRecord() throws IOException { StringWriter out = new StringWriter(); CsvWriter csvWriter = new CsvWriter(out, "\t"); csvWriter.writeRecord("a", "b", "c"); csvWriter.writeRecord("b", "c", "d"); csvWriter.close(); assertEquals("a\tb\tc\n" + "b\tc\td\n", out.toString()); }