@Test public void getTimestampFromResultSetWithCustomFormat() throws SQLException, IOException { Timestamp date = new Timestamp(109, 11, 15, 12, 0, 0, 0); long dateInMilliSeconds = date.getTime(); String customFormat = "mm/dd/yy HH:mm:ss"; SimpleDateFormat timeFormat = new SimpleDateFormat(customFormat); String[] expectedNames = {"Timestamp", "Null"}; String[] realValues = {Long.toString(dateInMilliSeconds), null}; String[] expectedValues = {timeFormat.format(date), ""}; int[] expectedTypes = {Types.TIMESTAMP, Types.TIMESTAMP}; ResultSetMetaData metaData = MockResultSetMetaDataBuilder.buildMetaData(expectedNames, expectedTypes); ResultSet resultSet = MockResultSetBuilder.buildResultSet(metaData, realValues, expectedTypes); ResultSetHelperService service = new ResultSetHelperService(); String[] columnValues = service.getColumnValues(resultSet, false, null, customFormat); assertArrayEquals(expectedValues, columnValues); }
public String[] getColumnValues(ResultSet rs) throws SQLException, IOException { return this.getColumnValues(rs, false, DEFAULT_DATE_FORMAT, DEFAULT_TIMESTAMP_FORMAT); }
ResultSetHelperService implements ResultSetHelper { public String[] getColumnValues(ResultSet rs) throws SQLException, IOException { return this.getColumnValues(rs, false, DEFAULT_DATE_FORMAT, DEFAULT_TIMESTAMP_FORMAT); } }
ResultSetHelperService implements ResultSetHelper { public String[] getColumnValues(ResultSet rs) throws SQLException, IOException { return this.getColumnValues(rs, false, DEFAULT_DATE_FORMAT, DEFAULT_TIMESTAMP_FORMAT); }  }
ResultSetHelperService implements ResultSetHelper { public String[] getColumnValues(ResultSet rs) throws SQLException, IOException { return this.getColumnValues(rs, false, DEFAULT_DATE_FORMAT, DEFAULT_TIMESTAMP_FORMAT); }  String[] getColumnNames(ResultSet rs); String[] getColumnValues(ResultSet rs); String[] getColumnValues(ResultSet rs, boolean trim); String[] getColumnValues(ResultSet rs, boolean trim, String dateFormatString, String timeFormatString); }
ResultSetHelperService implements ResultSetHelper { public String[] getColumnValues(ResultSet rs) throws SQLException, IOException { return this.getColumnValues(rs, false, DEFAULT_DATE_FORMAT, DEFAULT_TIMESTAMP_FORMAT); }  String[] getColumnNames(ResultSet rs); String[] getColumnValues(ResultSet rs); String[] getColumnValues(ResultSet rs, boolean trim); String[] getColumnValues(ResultSet rs, boolean trim, String dateFormatString, String timeFormatString); static final int CLOBBUFFERSIZE; static final int NVARCHAR; static final int NCHAR; static final int LONGNVARCHAR; static final int NCLOB; }