@Test(expected = SuperCsvCellProcessorException.class) public void testRowLineNumberCorrectness() throws SQLException, IOException { final int LINE_NUMBER = 5; final int ROW_NUMBER = 4; final Object[][] causesException = { { "1", "Alexander\r\nGraham", date(1945, 6, 13), }, { "2", "Bob", date(1919, 2, 25), }, { "3", "Alice", "CAUSES EXCEPTION", }, { "4", "Bill", date(1973, 7, 10), }, { "5", "Miranda", date(1999, 1, 3), }, }; final String[] headers = { "customerNo", "firstName", "birthDate" }; final ResultSet resultSet = new ResultSetMock(causesException, headers); final CellProcessor[] cellProcessors = { null, null, new FmtDate("dd/MM/yyyy") }; try { csvResultSetWriter.write(resultSet, cellProcessors); } catch(SuperCsvCellProcessorException e) { final int actualLineNumber = e.getCsvContext().getLineNumber(); final int actualRowNumber = e.getCsvContext().getRowNumber(); assertEquals("line number not correct", LINE_NUMBER, actualLineNumber); assertEquals("row number not correct", ROW_NUMBER, actualRowNumber); throw e; } }
public void write(final ResultSet resultSet) throws SQLException, IOException { if( resultSet == null ) { throw new NullPointerException("ResultSet cannot be null"); } writeHeaders(resultSet); writeContents(resultSet); }
CsvResultSetWriter extends AbstractCsvWriter implements ICsvResultSetWriter { public void write(final ResultSet resultSet) throws SQLException, IOException { if( resultSet == null ) { throw new NullPointerException("ResultSet cannot be null"); } writeHeaders(resultSet); writeContents(resultSet); } }
CsvResultSetWriter extends AbstractCsvWriter implements ICsvResultSetWriter { public void write(final ResultSet resultSet) throws SQLException, IOException { if( resultSet == null ) { throw new NullPointerException("ResultSet cannot be null"); } writeHeaders(resultSet); writeContents(resultSet); } CsvResultSetWriter(final Writer writer, final CsvPreference preference); }
CsvResultSetWriter extends AbstractCsvWriter implements ICsvResultSetWriter { public void write(final ResultSet resultSet) throws SQLException, IOException { if( resultSet == null ) { throw new NullPointerException("ResultSet cannot be null"); } writeHeaders(resultSet); writeContents(resultSet); } CsvResultSetWriter(final Writer writer, final CsvPreference preference); void write(final ResultSet resultSet); void write(ResultSet resultSet, CellProcessor[] writeProcessors); }
CsvResultSetWriter extends AbstractCsvWriter implements ICsvResultSetWriter { public void write(final ResultSet resultSet) throws SQLException, IOException { if( resultSet == null ) { throw new NullPointerException("ResultSet cannot be null"); } writeHeaders(resultSet); writeContents(resultSet); } CsvResultSetWriter(final Writer writer, final CsvPreference preference); void write(final ResultSet resultSet); void write(ResultSet resultSet, CellProcessor[] writeProcessors);  }