CachedResultSet implements ResultSet, Serializable { protected java.util.Date parseDate(String dateRepr) { try { return new SimpleDateFormat("yyyy-MM-dd").parse(dateRepr); } catch (ParseException e) { throw new RuntimeException(e); } } CachedResultSet(List<ColumnMap<String, Object>> rows);  CachedResultSet(List<ColumnMap<String, Object>> rows, ResultSetMetaData metadata);  CachedResultSet(ColumnMap<String, Object> singleRow); Object getObject(String columnName); Object getObject(int columnIndex); String getString(String columnName); String getString(int columnIndex); boolean first(); boolean last(); boolean next(); boolean isAfterLast(); boolean isBeforeFirst(); boolean isFirst(); boolean isLast(); ResultSetMetaData getMetaData(); void setFetchSize(int rows); Date getDate(int columnIndex, Calendar cal); Date getDate(String columnName, Calendar cal); BigDecimal getBigDecimal(int columnIndex); BigDecimal getBigDecimal(String columnName); Date getDate(int columnIndex); Date getDate(String columnName); Timestamp getTimestamp(int columnIndex); Timestamp getTimestamp(String columnName); Timestamp getTimestamp(int columnIndex, Calendar cal); Timestamp getTimestamp(String columnName, Calendar cal); Time getTime(String columnName); Time getTime(int columnIndex); BigDecimal getBigDecimal(int columnIndex, int scale); BigDecimal getBigDecimal(String columnName, int scale); float getFloat(int columnIndex); float getFloat(String columnName); double getDouble(int columnIndex); double getDouble(String columnName); long getLong(String columnName); long getLong(int columnIndex); int getInt(String columnName); int getInt(int columnIndex); short getShort(String columnName); short getShort(int columnIndex); InputStream getBinaryStream(int columnIndex); InputStream getBinaryStream(String columnName); Blob getBlob(int columnIndex); Blob getBlob(String columnName); boolean getBoolean(int columnIndex); boolean getBoolean(String columnName); byte getByte(int columnIndex); byte getByte(String columnName); byte[] getBytes(int columnIndex); byte[] getBytes(String columnName); boolean absolute(int row); void afterLast(); void beforeFirst(); void cancelRowUpdates(); void clearWarnings(); void close(); void deleteRow(); int findColumn(String columnName); Array getArray(int i); Array getArray(String colName); InputStream getAsciiStream(int columnIndex); InputStream getAsciiStream(String columnName); Reader getCharacterStream(int columnIndex); Reader getCharacterStream(String columnName); Clob getClob(int i); Clob getClob(String colName); int getConcurrency(); String getCursorName(); int getFetchDirection(); int getFetchSize(); Object getObject(int i, Map<String, Class<?>> map); Object getObject(String colName, Map<String, Class<?>> map); Ref getRef(int i); Ref getRef(String colName); int getRow(); Statement getStatement(); Time getTime(int columnIndex, Calendar cal); Time getTime(String columnName, Calendar cal); int getType(); URL getURL(int columnIndex); URL getURL(String columnName); InputStream getUnicodeStream(int columnIndex); InputStream getUnicodeStream(String columnName); SQLWarning getWarnings(); void insertRow(); void moveToCurrentRow(); void moveToInsertRow(); boolean previous(); void refreshRow(); boolean relative(int rows); boolean rowDeleted(); boolean rowInserted(); boolean rowUpdated(); void setFetchDirection(int direction); void updateArray(int columnIndex, Array x); void updateArray(String columnName, Array x); void updateAsciiStream(int columnIndex, InputStream x, int length); void updateAsciiStream(String columnName, InputStream x, int length); void updateBigDecimal(int columnIndex, BigDecimal x); void updateBigDecimal(String columnName, BigDecimal x); void updateBinaryStream(int columnIndex, InputStream x, int length); void updateBinaryStream(String columnName, InputStream x, int length); void updateBlob(int columnIndex, Blob x); void updateBlob(String columnName, Blob x); void updateBoolean(int columnIndex, boolean x); void updateBoolean(String columnName, boolean x); void updateByte(int columnIndex, byte x); void updateByte(String columnName, byte x); void updateBytes(int columnIndex, byte[] x); void updateBytes(String columnName, byte[] x); void updateCharacterStream(int columnIndex, Reader x, int length); void updateCharacterStream(String columnName, Reader reader,
                                      int length); void updateClob(int columnIndex, Clob x); void updateClob(String columnName, Clob x); void updateDate(int columnIndex, Date x); void updateDate(String columnName, Date x); void updateDouble(int columnIndex, double x); void updateDouble(String columnName, double x); void updateFloat(int columnIndex, float x); void updateFloat(String columnName, float x); void updateInt(int columnIndex, int x); void updateInt(String columnName, int x); void updateLong(int columnIndex, long x); void updateLong(String columnName, long x); void updateNull(int columnIndex); void updateNull(String columnName); void updateObject(int columnIndex, Object x); void updateObject(String columnName, Object x); void updateObject(int columnIndex, Object x, int scale); void updateObject(String columnName, Object x, int scale); void updateRef(int columnIndex, Ref x); void updateRef(String columnName, Ref x); void updateRow(); void updateShort(int columnIndex, short x); void updateShort(String columnName, short x); void updateString(int columnIndex, String x); void updateString(String columnName, String x); void updateTime(int columnIndex, Time x); void updateTime(String columnName, Time x); void updateTimestamp(int columnIndex, Timestamp x); void updateTimestamp(String columnName, Timestamp x); boolean wasNull(); T unwrap(Class<T> iface); boolean isWrapperFor(Class<?> iface); RowId getRowId(int columnIndex); RowId getRowId(String columnLabel); void updateRowId(int columnIndex, RowId x); void updateRowId(String columnLabel, RowId x); int getHoldability(); boolean isClosed(); void updateNString(int columnIndex, String nString); void updateNString(String columnLabel, String nString); void updateNClob(int columnIndex, NClob nClob); void updateNClob(String columnLabel, NClob nClob); NClob getNClob(int columnIndex); NClob getNClob(String columnLabel); SQLXML getSQLXML(int columnIndex); SQLXML getSQLXML(String columnLabel); void updateSQLXML(int columnIndex, SQLXML xmlObject); void updateSQLXML(String columnLabel, SQLXML xmlObject); String getNString(int columnIndex); String getNString(String columnLabel); Reader getNCharacterStream(int columnIndex); Reader getNCharacterStream(String columnLabel); void updateNCharacterStream(int columnIndex, Reader x, long length); void updateNCharacterStream(String columnLabel, Reader reader, long length); void updateAsciiStream(int columnIndex, InputStream x, long length); void updateBinaryStream(int columnIndex, InputStream x, long length); void updateCharacterStream(int columnIndex, Reader x, long length); void updateAsciiStream(String columnLabel, InputStream x, long length); void updateBinaryStream(String columnLabel, InputStream x, long length); void updateCharacterStream(String columnLabel, Reader reader, long length); void updateBlob(int columnIndex, InputStream inputStream, long length); void updateBlob(String columnLabel, InputStream inputStream, long length); void updateClob(int columnIndex, Reader reader, long length); void updateClob(String columnLabel, Reader reader, long length); void updateNClob(int columnIndex, Reader reader, long length); void updateNClob(String columnLabel, Reader reader, long length); void updateNCharacterStream(int columnIndex, Reader x); void updateNCharacterStream(String columnLabel, Reader reader); void updateAsciiStream(int columnIndex, InputStream x); void updateBinaryStream(int columnIndex, InputStream x); void updateCharacterStream(int columnIndex, Reader x); void updateAsciiStream(String columnLabel, InputStream x); void updateBinaryStream(String columnLabel, InputStream x); void updateCharacterStream(String columnLabel, Reader reader); void updateBlob(int columnIndex, InputStream inputStream); void updateBlob(String columnLabel, InputStream inputStream); void updateClob(int columnIndex, Reader reader); void updateClob(String columnLabel, Reader reader); void updateNClob(int columnIndex, Reader reader); void updateNClob(String columnLabel, Reader reader); @Override T getObject(int columnIndex, Class<T> type); @Override T getObject(String columnLabel, Class<T> type);  }
@Test public void testParseDate() { Date actual = cachedResultSet.parseDate("2017-06-23"); Calendar calendar = Calendar.getInstance(); calendar.setTime(actual); assertEquals(2017, calendar.get(Calendar.YEAR)); assertEquals(Calendar.JUNE, calendar.get(Calendar.MONTH)); assertEquals(23, calendar.get(Calendar.DAY_OF_MONTH)); }