@Test public void testWriteComment() throws IOException { assertEquals(0, abstractWriter.getLineNumber()); assertEquals(0, abstractWriter.getRowNumber()); final String comment = "#this is a comment"; abstractWriter.writeComment(comment); assertEquals(1, abstractWriter.getLineNumber()); assertEquals(0, abstractWriter.getRowNumber()); final String header = "this,is,the,header"; abstractWriter.writeHeader(header.split(",")); assertEquals(2, abstractWriter.getLineNumber()); assertEquals(1, abstractWriter.getRowNumber()); abstractWriter.writeComment(comment); assertEquals(3, abstractWriter.getLineNumber()); assertEquals(1, abstractWriter.getRowNumber()); abstractWriter.writeHeader(header.split(",")); assertEquals(4, abstractWriter.getLineNumber()); assertEquals(2, abstractWriter.getRowNumber()); abstractWriter.flush(); final String eol = PREFS.getEndOfLineSymbols(); final String expected = comment + eol + header + eol + comment + eol + header + eol; assertEquals(expected, writer.toString()); }
public void writeComment(final String comment) throws IOException { lineNumber++; if( comment == null ) { throw new NullPointerException(String.format("comment to write should not be null on line %d", lineNumber)); } writer.write(comment + preference.getEndOfLineSymbols()); }
AbstractCsvWriter implements ICsvWriter { public void writeComment(final String comment) throws IOException { lineNumber++; if( comment == null ) { throw new NullPointerException(String.format("comment to write should not be null on line %d", lineNumber)); } writer.write(comment + preference.getEndOfLineSymbols()); } }
AbstractCsvWriter implements ICsvWriter { public void writeComment(final String comment) throws IOException { lineNumber++; if( comment == null ) { throw new NullPointerException(String.format("comment to write should not be null on line %d", lineNumber)); } writer.write(comment + preference.getEndOfLineSymbols()); } AbstractCsvWriter(final Writer writer, final CsvPreference preference);  AbstractCsvWriter(final Writer writer, final CsvPreference preference, boolean bufferizeWriter); }
AbstractCsvWriter implements ICsvWriter { public void writeComment(final String comment) throws IOException { lineNumber++; if( comment == null ) { throw new NullPointerException(String.format("comment to write should not be null on line %d", lineNumber)); } writer.write(comment + preference.getEndOfLineSymbols()); } AbstractCsvWriter(final Writer writer, final CsvPreference preference);  AbstractCsvWriter(final Writer writer, final CsvPreference preference, boolean bufferizeWriter); void close(); void flush(); int getLineNumber(); int getRowNumber(); void writeComment(final String comment); void writeHeader(final String... header); }
AbstractCsvWriter implements ICsvWriter { public void writeComment(final String comment) throws IOException { lineNumber++; if( comment == null ) { throw new NullPointerException(String.format("comment to write should not be null on line %d", lineNumber)); } writer.write(comment + preference.getEndOfLineSymbols()); } AbstractCsvWriter(final Writer writer, final CsvPreference preference);  AbstractCsvWriter(final Writer writer, final CsvPreference preference, boolean bufferizeWriter); void close(); void flush(); int getLineNumber(); int getRowNumber(); void writeComment(final String comment); void writeHeader(final String... header);  }