package au.com.bytecode.opencsv; /** Copyright 2005 Bytecode Pty Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import java.io.InputStream; import java.io.Reader; import java.math.BigDecimal; import java.net.URL; import java.sql.*; import java.util.Calendar; import java.util.Map; /** * Created by IntelliJ IDEA. * User: scott * Date: Dec 12, 2009 * Time: 10:15:03 AM * To change this template use File | Settings | File Templates. */ public class MockResultSet implements ResultSet { private int numberOfResults = 0; private ResultSetMetaData metaData; private String[] columnValues; private boolean lastValueReadNull; private void setLastValueReadNull(String value){ lastValueReadNull = (value == null); } public void setColumnValues(String[] values) { columnValues = values; } public void setNumberOfResults(int results){ numberOfResults = results; } public void setMetaData(ResultSetMetaData data) { metaData = data; } public boolean next() throws SQLException { return numberOfResults-- > 0; //To change body of implemented methods use File | Settings | File Templates. } public void close() throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public boolean wasNull() throws SQLException { return lastValueReadNull; //To change body of implemented methods use File | Settings | File Templates. } public String getString(int i) throws SQLException { return columnValues[i-1]; } public boolean getBoolean(int i) throws SQLException { return Boolean.valueOf(columnValues[i-1]); //To change body of implemented methods use File | Settings | File Templates. } public byte getByte(int i) throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public short getShort(int i) throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public int getInt(int i) throws SQLException { setLastValueReadNull(columnValues[i-1]); return columnValues[i-1] == null ? 0 : Integer.valueOf(columnValues[i-1]); } public long getLong(int i) throws SQLException { setLastValueReadNull(columnValues[i-1]); return columnValues[i-1] == null ? 0 : Long.valueOf(columnValues[i-1]); } public float getFloat(int i) throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public double getDouble(int i) throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public BigDecimal getBigDecimal(int i, int i1) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public byte[] getBytes(int i) throws SQLException { return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. } public Date getDate(int i) throws SQLException { return columnValues[i-1] == null ? null : new Date(Long.valueOf(columnValues[i-1])); } public Time getTime(int i) throws SQLException { return columnValues[i-1] == null ? null : new Time(Long.valueOf(columnValues[i-1])); } public Timestamp getTimestamp(int i) throws SQLException { return columnValues[i-1] == null ? null : new Timestamp(Long.valueOf(columnValues[i-1])); } public InputStream getAsciiStream(int i) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public InputStream getUnicodeStream(int i) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public InputStream getBinaryStream(int i) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public String getString(String s) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public boolean getBoolean(String s) throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public byte getByte(String s) throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public short getShort(String s) throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public int getInt(String s) throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public long getLong(String s) throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public float getFloat(String s) throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public double getDouble(String s) throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public BigDecimal getBigDecimal(String s, int i) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public byte[] getBytes(String s) throws SQLException { return new byte[0]; //To change body of implemented methods use File | Settings | File Templates. } public Date getDate(String s) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Time getTime(String s) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Timestamp getTimestamp(String s) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public InputStream getAsciiStream(String s) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public InputStream getUnicodeStream(String s) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public InputStream getBinaryStream(String s) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public SQLWarning getWarnings() throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public void clearWarnings() throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public String getCursorName() throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public ResultSetMetaData getMetaData() throws SQLException { return metaData; } public Object getObject(int i) throws SQLException { setLastValueReadNull(columnValues[i-1]); return columnValues[i-1]; //To change body of implemented methods use File | Settings | File Templates. } public Object getObject(String s) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public int findColumn(String s) throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public Reader getCharacterStream(int i) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Reader getCharacterStream(String s) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public BigDecimal getBigDecimal(int i) throws SQLException { setLastValueReadNull(columnValues[i-1]); return columnValues[i-1] == null ? null : new BigDecimal(columnValues[i-1]); } public BigDecimal getBigDecimal(String s) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public boolean isBeforeFirst() throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public boolean isAfterLast() throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public boolean isFirst() throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public boolean isLast() throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public void beforeFirst() throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void afterLast() throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public boolean first() throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public boolean last() throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public int getRow() throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public boolean absolute(int i) throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public boolean relative(int i) throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public boolean previous() throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public void setFetchDirection(int i) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public int getFetchDirection() throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public void setFetchSize(int i) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public int getFetchSize() throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public int getType() throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public int getConcurrency() throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public boolean rowUpdated() throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public boolean rowInserted() throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public boolean rowDeleted() throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public void updateNull(int i) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBoolean(int i, boolean b) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateByte(int i, byte b) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateShort(int i, short s) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateInt(int i, int i1) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateLong(int i, long l) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateFloat(int i, float v) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateDouble(int i, double v) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBigDecimal(int i, BigDecimal bigDecimal) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateString(int i, String s) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBytes(int i, byte[] bytes) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateDate(int i, Date date) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateTime(int i, Time time) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateTimestamp(int i, Timestamp timestamp) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateAsciiStream(int i, InputStream inputStream, int i1) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBinaryStream(int i, InputStream inputStream, int i1) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateCharacterStream(int i, Reader reader, int i1) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateObject(int i, Object o, int i1) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateObject(int i, Object o) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateNull(String s) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBoolean(String s, boolean b) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateByte(String s, byte b) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateShort(String s, short i) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateInt(String s, int i) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateLong(String s, long l) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateFloat(String s, float v) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateDouble(String s, double v) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBigDecimal(String s, BigDecimal bigDecimal) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateString(String s, String s1) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBytes(String s, byte[] bytes) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateDate(String s, Date date) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateTime(String s, Time time) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateTimestamp(String s, Timestamp timestamp) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateAsciiStream(String s, InputStream inputStream, int i) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBinaryStream(String s, InputStream inputStream, int i) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateCharacterStream(String s, Reader reader, int i) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateObject(String s, Object o, int i) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateObject(String s, Object o) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void insertRow() throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateRow() throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void deleteRow() throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void refreshRow() throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void cancelRowUpdates() throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void moveToInsertRow() throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void moveToCurrentRow() throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public Statement getStatement() throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Object getObject(int i, Map<String, Class<?>> stringClassMap) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Ref getRef(int i) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Blob getBlob(int i) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Clob getClob(int i) throws SQLException { return columnValues[i-1] == null ? null : new MockClob(columnValues[i-1]); } public Array getArray(int i) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Object getObject(String s, Map<String, Class<?>> stringClassMap) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Ref getRef(String s) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Blob getBlob(String s) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Clob getClob(String s) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Array getArray(String s) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Date getDate(int i, Calendar calendar) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Date getDate(String s, Calendar calendar) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Time getTime(int i, Calendar calendar) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Time getTime(String s, Calendar calendar) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Timestamp getTimestamp(int i, Calendar calendar) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Timestamp getTimestamp(String s, Calendar calendar) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public URL getURL(int i) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public URL getURL(String s) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public void updateRef(int i, Ref ref) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateRef(String s, Ref ref) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBlob(int i, Blob blob) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBlob(String s, Blob blob) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateClob(int i, Clob clob) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateClob(String s, Clob clob) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateArray(int i, Array array) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateArray(String s, Array array) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public int getHoldability() throws SQLException { return 0; //To change body of implemented methods use File | Settings | File Templates. } public boolean isClosed() throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } public void updateNString(int i, String s) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateNString(String s, String s1) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public String getNString(int i) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public String getNString(String s) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Reader getNCharacterStream(int i) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public Reader getNCharacterStream(String s) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public void updateNCharacterStream(int i, Reader reader, long l) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateNCharacterStream(String s, Reader reader, long l) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateAsciiStream(int i, InputStream inputStream, long l) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBinaryStream(int i, InputStream inputStream, long l) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateCharacterStream(int i, Reader reader, long l) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateAsciiStream(String s, InputStream inputStream, long l) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBinaryStream(String s, InputStream inputStream, long l) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateCharacterStream(String s, Reader reader, long l) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBlob(int i, InputStream inputStream, long l) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBlob(String s, InputStream inputStream, long l) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateClob(int i, Reader reader, long l) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateClob(String s, Reader reader, long l) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateNClob(int i, Reader reader, long l) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateNClob(String s, Reader reader, long l) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateNCharacterStream(int i, Reader reader) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateNCharacterStream(String s, Reader reader) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateAsciiStream(int i, InputStream inputStream) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBinaryStream(int i, InputStream inputStream) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateCharacterStream(int i, Reader reader) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateAsciiStream(String s, InputStream inputStream) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBinaryStream(String s, InputStream inputStream) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateCharacterStream(String s, Reader reader) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBlob(int i, InputStream inputStream) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateBlob(String s, InputStream inputStream) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateClob(int i, Reader reader) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateClob(String s, Reader reader) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateNClob(int i, Reader reader) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public void updateNClob(String s, Reader reader) throws SQLException { //To change body of implemented methods use File | Settings | File Templates. } public <T> T unwrap(Class<T> tClass) throws SQLException { return null; //To change body of implemented methods use File | Settings | File Templates. } public boolean isWrapperFor(Class<?> aClass) throws SQLException { return false; //To change body of implemented methods use File | Settings | File Templates. } }