You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/03/18 22:45:33 UTC
(commons-dbutils) 08/08: BaseResultSetHandler implements ResultSet
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbutils.git
commit 5bc759beff4c804f70e46a21dffb64219997c4ea
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Mar 18 18:45:10 2025 -0400
BaseResultSetHandler implements ResultSet
- More tests
- Capitalize constant names in tests
- Rename a test class
- Use a real JDBC driver (H2) from some tests
---
pom.xml | 22 +-
src/changes/changes.xml | 1 +
.../commons/dbutils/BaseResultSetHandler.java | 1183 +++++---------
.../BaseResultSetHandlerDelegationTest.java | 1677 ++++++++++++++++++++
...st.java => BaseResultSetHandlerHandleTest.java} | 18 +-
.../org/apache/commons/dbutils/BaseTestCase.java | 42 +-
.../commons/dbutils/BasicRowProcessorTest.java | 10 +-
.../apache/commons/dbutils/BeanProcessorTest.java | 6 +-
.../org/apache/commons/dbutils/MockResultSet.java | 154 +-
.../commons/dbutils/ResultSetIteratorTest.java | 4 +-
.../commons/dbutils/handlers/ArrayHandlerTest.java | 2 +-
.../dbutils/handlers/ArrayListHandlerTest.java | 6 +-
.../dbutils/handlers/BeanListHandlerTest.java | 6 +-
.../dbutils/handlers/ColumnListHandlerTest.java | 6 +-
.../commons/dbutils/handlers/KeyedHandlerTest.java | 14 +-
.../commons/dbutils/handlers/MapHandlerTest.java | 2 +-
.../dbutils/handlers/MapListHandlerTest.java | 6 +-
.../wrappers/StringTrimmedResultSetTest.java | 2 +-
18 files changed, 2261 insertions(+), 900 deletions(-)
diff --git a/pom.xml b/pom.xml
index 7114f76..7b4b262 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,6 +60,18 @@
<version>3.17.0</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>2.3.232</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-jxpath</groupId>
+ <artifactId>commons-jxpath</artifactId>
+ <version>1.3</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<distributionManagement>
@@ -200,8 +212,8 @@
<configLocation>${checkstyle.config.file}</configLocation>
<enableRulesSummary>false</enableRulesSummary>
<headerLocation>${checkstyle.header.file}</headerLocation>
- <suppressionsLocation>${basedir}/src/site/resources/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
- <suppressionsFileExpression>${basedir}/src/site/resources/checkstyle/checkstyle-suppressions.xml</suppressionsFileExpression>
+ <suppressionsLocation>${basedir}/src/conf/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
+ <suppressionsFileExpression>${basedir}/src/conf/checkstyle/checkstyle-suppressions.xml</suppressionsFileExpression>
</configuration>
</plugin>
<plugin>
@@ -217,12 +229,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${commons.pmd.version}</version>
- <configuration>
- <targetJdk>${maven.compiler.source}</targetJdk>
- <rulesets>
- <ruleset>${basedir}/src/site/resources/pmd/pmd-ruleset.xml</ruleset>
- </rulesets>
- </configuration>
</plugin>
</plugins>
</reporting>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index d850018..29a7859 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -55,6 +55,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" dev="ggregory" due-to="strangelookingnerd, Gary Gregory">Migrate tests to JUnit5 #324.</action>
<action type="fix" dev="ggregory" due-to="strangelookingnerd, Gary Gregory">Deprecate DbUtils.DbUtils().</action>
<!-- ADD -->
+ <action type="fix" dev="ggregory" due-to="strangelookingnerd, Gary Gregory">BaseResultSetHandler implements ResultSet.</action>
<!-- UPDATE -->
<action dev="ggregory" type="update" due-to="Gary Gregory">Bump Java from 8 to 11.</action>
<action dev="ggregory" type="update" due-to="Gary Gregory">Bump commons-parent from 62 to 78 #256, #277, #295, #301, #305, #308, #314.</action>
diff --git a/src/main/java/org/apache/commons/dbutils/BaseResultSetHandler.java b/src/main/java/org/apache/commons/dbutils/BaseResultSetHandler.java
index 7fc2021..edee386 100644
--- a/src/main/java/org/apache/commons/dbutils/BaseResultSetHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/BaseResultSetHandler.java
@@ -30,6 +30,7 @@ import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.RowId;
import java.sql.SQLException;
+import java.sql.SQLType;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Statement;
@@ -50,8 +51,9 @@ import java.util.Map;
*
* @param <T> the target type the input ResultSet will be converted to.
* @since 1.6
+ * @since 1.9.0 implements {@link ResultSet}.
*/
-public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
+public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T>, ResultSet {
/**
* The adapted ResultSet.
@@ -59,605 +61,457 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
private ResultSet resultSet;
/**
- * TODO. A
+ * Constructs a new instance.
*/
- protected final boolean absolute(final int row) throws SQLException {
+ public BaseResultSetHandler() {
+ // empty
+ }
+
+ @Override
+ public final boolean absolute(final int row) throws SQLException {
return resultSet.absolute(row);
}
- /**
- * TODO.
- */
- protected final void afterLast() throws SQLException {
+ @Override
+ public final void afterLast() throws SQLException {
resultSet.afterLast();
}
- /**
- * TODO.
- */
- protected final void beforeFirst() throws SQLException {
+ @Override
+ public final void beforeFirst() throws SQLException {
resultSet.beforeFirst();
}
- /**
- * TODO.
- */
- protected final void cancelRowUpdates() throws SQLException {
+ @Override
+ public final void cancelRowUpdates() throws SQLException {
resultSet.cancelRowUpdates();
}
- /**
- * TODO.
- */
- protected final void clearWarnings() throws SQLException {
+ @Override
+ public final void clearWarnings() throws SQLException {
resultSet.clearWarnings();
}
- /**
- * TODO.
- */
- protected final void close() throws SQLException {
+ @Override
+ public final void close() throws SQLException {
resultSet.close();
}
- /**
- * TODO.
- */
- protected final void deleteRow() throws SQLException {
+ @Override
+ public final void deleteRow() throws SQLException {
resultSet.deleteRow();
}
- /**
- * TODO.
- */
- protected final int findColumn(final String columnLabel) throws SQLException {
+ @Override
+ public final int findColumn(final String columnLabel) throws SQLException {
return resultSet.findColumn(columnLabel);
}
- /**
- * TODO.
- */
- protected final boolean first() throws SQLException {
+ @Override
+ public final boolean first() throws SQLException {
return resultSet.first();
}
+ /**
+ * Gets the underlying result set.
+ *
+ * @return the underlying result set.
+ */
protected final ResultSet getAdaptedResultSet() {
return resultSet;
}
- /**
- * TODO.
- */
- protected final Array getArray(final int columnIndex) throws SQLException {
+ @Override
+ public final Array getArray(final int columnIndex) throws SQLException {
return resultSet.getArray(columnIndex);
}
- /**
- * TODO.
- */
- protected final Array getArray(final String columnLabel) throws SQLException {
+ @Override
+ public final Array getArray(final String columnLabel) throws SQLException {
return resultSet.getArray(columnLabel);
}
- /**
- * TODO.
- */
- protected final InputStream getAsciiStream(final int columnIndex) throws SQLException {
+ @Override
+ public final InputStream getAsciiStream(final int columnIndex) throws SQLException {
return resultSet.getAsciiStream(columnIndex);
}
- /**
- * TODO.
- */
- protected final InputStream getAsciiStream(final String columnLabel) throws SQLException {
+ @Override
+ public final InputStream getAsciiStream(final String columnLabel) throws SQLException {
return resultSet.getAsciiStream(columnLabel);
}
- /**
- * TODO.
- */
- protected final BigDecimal getBigDecimal(final int columnIndex) throws SQLException {
+ @Override
+ public final BigDecimal getBigDecimal(final int columnIndex) throws SQLException {
return resultSet.getBigDecimal(columnIndex);
}
- /**
- * TODO.
- */
+ @Override
@Deprecated
- protected final BigDecimal getBigDecimal(final int columnIndex, final int scale) throws SQLException {
+ public final BigDecimal getBigDecimal(final int columnIndex, final int scale) throws SQLException {
return resultSet.getBigDecimal(columnIndex, scale);
}
- /**
- * TODO.
- */
- protected final BigDecimal getBigDecimal(final String columnLabel) throws SQLException {
+ @Override
+ public final BigDecimal getBigDecimal(final String columnLabel) throws SQLException {
return resultSet.getBigDecimal(columnLabel);
}
- /**
- * TODO.
- */
+ @Override
@Deprecated
- protected final BigDecimal getBigDecimal(final String columnLabel, final int scale) throws SQLException {
+ public final BigDecimal getBigDecimal(final String columnLabel, final int scale) throws SQLException {
return resultSet.getBigDecimal(columnLabel, scale);
}
- /**
- * TODO.
- */
- protected final InputStream getBinaryStream(final int columnIndex) throws SQLException {
+ @Override
+ public final InputStream getBinaryStream(final int columnIndex) throws SQLException {
return resultSet.getBinaryStream(columnIndex);
}
- /**
- * TODO.
- */
- protected final InputStream getBinaryStream(final String columnLabel) throws SQLException {
+ @Override
+ public final InputStream getBinaryStream(final String columnLabel) throws SQLException {
return resultSet.getBinaryStream(columnLabel);
}
- /**
- * TODO.
- */
- protected final Blob getBlob(final int columnIndex) throws SQLException {
+ @Override
+ public final Blob getBlob(final int columnIndex) throws SQLException {
return resultSet.getBlob(columnIndex);
}
- /**
- * TODO.
- */
- protected final Blob getBlob(final String columnLabel) throws SQLException {
+ @Override
+ public final Blob getBlob(final String columnLabel) throws SQLException {
return resultSet.getBlob(columnLabel);
}
- /**
- * TODO.
- */
- protected final boolean getBoolean(final int columnIndex) throws SQLException {
+ @Override
+ public final boolean getBoolean(final int columnIndex) throws SQLException {
return resultSet.getBoolean(columnIndex);
}
- /**
- * TODO.
- */
- protected final boolean getBoolean(final String columnLabel) throws SQLException {
+ @Override
+ public final boolean getBoolean(final String columnLabel) throws SQLException {
return resultSet.getBoolean(columnLabel);
}
- /**
- * TODO.
- */
- protected final byte getByte(final int columnIndex) throws SQLException {
+ @Override
+ public final byte getByte(final int columnIndex) throws SQLException {
return resultSet.getByte(columnIndex);
}
- /**
- * TODO.
- */
- protected final byte getByte(final String columnLabel) throws SQLException {
+ @Override
+ public final byte getByte(final String columnLabel) throws SQLException {
return resultSet.getByte(columnLabel);
}
- /**
- * TODO.
- */
- protected final byte[] getBytes(final int columnIndex) throws SQLException {
+ @Override
+ public final byte[] getBytes(final int columnIndex) throws SQLException {
return resultSet.getBytes(columnIndex);
}
- /**
- * TODO.
- */
- protected final byte[] getBytes(final String columnLabel) throws SQLException {
+ @Override
+ public final byte[] getBytes(final String columnLabel) throws SQLException {
return resultSet.getBytes(columnLabel);
}
- /**
- * TODO.
- */
- protected final Reader getCharacterStream(final int columnIndex) throws SQLException {
+ @Override
+ public final Reader getCharacterStream(final int columnIndex) throws SQLException {
return resultSet.getCharacterStream(columnIndex);
}
- /**
- * TODO.
- */
- protected final Reader getCharacterStream(final String columnLabel) throws SQLException {
+ @Override
+ public final Reader getCharacterStream(final String columnLabel) throws SQLException {
return resultSet.getCharacterStream(columnLabel);
}
- /**
- * TODO.
- */
- protected final Clob getClob(final int columnIndex) throws SQLException {
+ @Override
+ public final Clob getClob(final int columnIndex) throws SQLException {
return resultSet.getClob(columnIndex);
}
- /**
- * TODO.
- */
- protected final Clob getClob(final String columnLabel) throws SQLException {
+ @Override
+ public final Clob getClob(final String columnLabel) throws SQLException {
return resultSet.getClob(columnLabel);
}
- /**
- * TODO.
- */
- protected final int getConcurrency() throws SQLException {
+ @Override
+ public final int getConcurrency() throws SQLException {
return resultSet.getConcurrency();
}
- /**
- * TODO.
- */
- protected final String getCursorName() throws SQLException {
+ @Override
+ public final String getCursorName() throws SQLException {
return resultSet.getCursorName();
}
- /**
- * TODO.
- */
- protected final Date getDate(final int columnIndex) throws SQLException {
+ @Override
+ public final Date getDate(final int columnIndex) throws SQLException {
return resultSet.getDate(columnIndex);
}
- /**
- * TODO.
- */
- protected final Date getDate(final int columnIndex, final Calendar cal) throws SQLException {
+ @Override
+ public final Date getDate(final int columnIndex, final Calendar cal) throws SQLException {
return resultSet.getDate(columnIndex, cal);
}
- /**
- * TODO.
- */
- protected final Date getDate(final String columnLabel) throws SQLException {
+ @Override
+ public final Date getDate(final String columnLabel) throws SQLException {
return resultSet.getDate(columnLabel);
}
- /**
- * TODO.
- */
- protected final Date getDate(final String columnLabel, final Calendar cal) throws SQLException {
+ @Override
+ public final Date getDate(final String columnLabel, final Calendar cal) throws SQLException {
return resultSet.getDate(columnLabel, cal);
}
- /**
- * TODO.
- */
- protected final double getDouble(final int columnIndex) throws SQLException {
+ @Override
+ public final double getDouble(final int columnIndex) throws SQLException {
return resultSet.getDouble(columnIndex);
}
- /**
- * TODO.
- */
- protected final double getDouble(final String columnLabel) throws SQLException {
+ @Override
+ public final double getDouble(final String columnLabel) throws SQLException {
return resultSet.getDouble(columnLabel);
}
- /**
- * TODO.
- */
- protected final int getFetchDirection() throws SQLException {
+ @Override
+ public final int getFetchDirection() throws SQLException {
return resultSet.getFetchDirection();
}
- /**
- * TODO.
- */
- protected final int getFetchSize() throws SQLException {
+ @Override
+ public final int getFetchSize() throws SQLException {
return resultSet.getFetchSize();
}
- /**
- * TODO.
- */
- protected final float getFloat(final int columnIndex) throws SQLException {
+ @Override
+ public final float getFloat(final int columnIndex) throws SQLException {
return resultSet.getFloat(columnIndex);
}
- /**
- * TODO.
- */
- protected final float getFloat(final String columnLabel) throws SQLException {
+ @Override
+ public final float getFloat(final String columnLabel) throws SQLException {
return resultSet.getFloat(columnLabel);
}
- /**
- * TODO.
- */
- protected final int getHoldability() throws SQLException {
+ @Override
+ public final int getHoldability() throws SQLException {
return resultSet.getHoldability();
}
- /**
- * TODO.
- */
- protected final int getInt(final int columnIndex) throws SQLException {
+ @Override
+ public final int getInt(final int columnIndex) throws SQLException {
return resultSet.getInt(columnIndex);
}
- /**
- * TODO.
- */
- protected final int getInt(final String columnLabel) throws SQLException {
+ @Override
+ public final int getInt(final String columnLabel) throws SQLException {
return resultSet.getInt(columnLabel);
}
- /**
- * TODO.
- */
- protected final long getLong(final int columnIndex) throws SQLException {
+ @Override
+ public final long getLong(final int columnIndex) throws SQLException {
return resultSet.getLong(columnIndex);
}
- /**
- * TODO.
- */
- protected final long getLong(final String columnLabel) throws SQLException {
+ @Override
+ public final long getLong(final String columnLabel) throws SQLException {
return resultSet.getLong(columnLabel);
}
- /**
- * TODO.
- */
- protected final ResultSetMetaData getMetaData() throws SQLException {
+ @Override
+ public final ResultSetMetaData getMetaData() throws SQLException {
return resultSet.getMetaData();
}
- /**
- * TODO.
- */
- protected final Reader getNCharacterStream(final int columnIndex) throws SQLException {
+ @Override
+ public final Reader getNCharacterStream(final int columnIndex) throws SQLException {
return resultSet.getNCharacterStream(columnIndex);
}
- /**
- * TODO.
- */
- protected final Reader getNCharacterStream(final String columnLabel) throws SQLException {
+ @Override
+ public final Reader getNCharacterStream(final String columnLabel) throws SQLException {
return resultSet.getNCharacterStream(columnLabel);
}
- /**
- * TODO.
- */
- protected final NClob getNClob(final int columnIndex) throws SQLException {
+ @Override
+ public final NClob getNClob(final int columnIndex) throws SQLException {
return resultSet.getNClob(columnIndex);
}
- /**
- * TODO.
- */
- protected final NClob getNClob(final String columnLabel) throws SQLException {
+ @Override
+ public final NClob getNClob(final String columnLabel) throws SQLException {
return resultSet.getNClob(columnLabel);
}
- /**
- * TODO.
- */
- protected final String getNString(final int columnIndex) throws SQLException {
+ @Override
+ public final String getNString(final int columnIndex) throws SQLException {
return resultSet.getNString(columnIndex);
}
- /**
- * TODO.
- */
- protected final String getNString(final String columnLabel) throws SQLException {
+ @Override
+ public final String getNString(final String columnLabel) throws SQLException {
return resultSet.getNString(columnLabel);
}
- /**
- * TODO.
- */
- protected final Object getObject(final int columnIndex) throws SQLException {
+ @Override
+ public final Object getObject(final int columnIndex) throws SQLException {
return resultSet.getObject(columnIndex);
}
- /**
- * TODO.
- */
- protected final Object getObject(final int columnIndex, final Map<String, Class<?>> map) throws SQLException {
+ @Override
+ public <R> R getObject(int columnIndex, Class<R> type) throws SQLException {
+ return resultSet.getObject(columnIndex, type);
+ }
+
+ @Override
+ public final Object getObject(final int columnIndex, final Map<String, Class<?>> map) throws SQLException {
return resultSet.getObject(columnIndex, map);
}
- /**
- * TODO.
- */
- protected final Object getObject(final String columnLabel) throws SQLException {
+ @Override
+ public final Object getObject(final String columnLabel) throws SQLException {
return resultSet.getObject(columnLabel);
}
- /**
- * TODO.
- */
- protected final Object getObject(final String columnLabel, final Map<String, Class<?>> map) throws SQLException {
+ @Override
+ public <R> R getObject(String columnLabel, Class<R> type) throws SQLException {
+ return resultSet.getObject(columnLabel, type);
+ }
+
+ @Override
+ public final Object getObject(final String columnLabel, final Map<String, Class<?>> map) throws SQLException {
return resultSet.getObject(columnLabel, map);
}
- /**
- * TODO.
- */
- protected final Ref getRef(final int columnIndex) throws SQLException {
+ @Override
+ public final Ref getRef(final int columnIndex) throws SQLException {
return resultSet.getRef(columnIndex);
}
- /**
- * TODO.
- */
- protected final Ref getRef(final String columnLabel) throws SQLException {
+ @Override
+ public final Ref getRef(final String columnLabel) throws SQLException {
return resultSet.getRef(columnLabel);
}
- /**
- * TODO.
- */
- protected final int getRow() throws SQLException {
+ @Override
+ public final int getRow() throws SQLException {
return resultSet.getRow();
}
- /**
- * TODO.
- */
- protected final RowId getRowId(final int columnIndex) throws SQLException {
+ @Override
+ public final RowId getRowId(final int columnIndex) throws SQLException {
return resultSet.getRowId(columnIndex);
}
- /**
- * TODO.
- */
- protected final RowId getRowId(final String columnLabel) throws SQLException {
+ @Override
+ public final RowId getRowId(final String columnLabel) throws SQLException {
return resultSet.getRowId(columnLabel);
}
- /**
- * TODO.
- */
- protected final short getShort(final int columnIndex) throws SQLException {
+ @Override
+ public final short getShort(final int columnIndex) throws SQLException {
return resultSet.getShort(columnIndex);
}
- /**
- * TODO.
- */
- protected final short getShort(final String columnLabel) throws SQLException {
+ @Override
+ public final short getShort(final String columnLabel) throws SQLException {
return resultSet.getShort(columnLabel);
}
- /**
- * TODO.
- */
- protected final SQLXML getSQLXML(final int columnIndex) throws SQLException {
+ @Override
+ public final SQLXML getSQLXML(final int columnIndex) throws SQLException {
return resultSet.getSQLXML(columnIndex);
}
- /**
- * TODO.
- */
- protected final SQLXML getSQLXML(final String columnLabel) throws SQLException {
+ @Override
+ public final SQLXML getSQLXML(final String columnLabel) throws SQLException {
return resultSet.getSQLXML(columnLabel);
}
- /**
- * TODO.
- */
- protected final Statement getStatement() throws SQLException {
+ @Override
+ public final Statement getStatement() throws SQLException {
return resultSet.getStatement();
}
- /**
- * TODO.
- */
- protected final String getString(final int columnIndex) throws SQLException {
+ @Override
+ public final String getString(final int columnIndex) throws SQLException {
return resultSet.getString(columnIndex);
}
- /**
- * TODO.
- */
- protected final String getString(final String columnLabel) throws SQLException {
+ @Override
+ public final String getString(final String columnLabel) throws SQLException {
return resultSet.getString(columnLabel);
}
- /**
- * TODO.
- */
- protected final Time getTime(final int columnIndex) throws SQLException {
+ @Override
+ public final Time getTime(final int columnIndex) throws SQLException {
return resultSet.getTime(columnIndex);
}
- /**
- * TODO.
- */
- protected final Time getTime(final int columnIndex, final Calendar cal) throws SQLException {
+ @Override
+ public final Time getTime(final int columnIndex, final Calendar cal) throws SQLException {
return resultSet.getTime(columnIndex, cal);
}
- /**
- * TODO.
- */
- protected final Time getTime(final String columnLabel) throws SQLException {
+ @Override
+ public final Time getTime(final String columnLabel) throws SQLException {
return resultSet.getTime(columnLabel);
}
- /**
- * TODO.
- */
- protected final Time getTime(final String columnLabel, final Calendar cal) throws SQLException {
+ @Override
+ public final Time getTime(final String columnLabel, final Calendar cal) throws SQLException {
return resultSet.getTime(columnLabel, cal);
}
- /**
- * TODO.
- */
- protected final Timestamp getTimestamp(final int columnIndex) throws SQLException {
+ @Override
+ public final Timestamp getTimestamp(final int columnIndex) throws SQLException {
return resultSet.getTimestamp(columnIndex);
}
- /**
- * TODO.
- */
- protected final Timestamp getTimestamp(final int columnIndex, final Calendar cal) throws SQLException {
+ @Override
+ public final Timestamp getTimestamp(final int columnIndex, final Calendar cal) throws SQLException {
return resultSet.getTimestamp(columnIndex, cal);
}
- /**
- * TODO.
- */
- protected final Timestamp getTimestamp(final String columnLabel) throws SQLException {
+ @Override
+ public final Timestamp getTimestamp(final String columnLabel) throws SQLException {
return resultSet.getTimestamp(columnLabel);
}
- /**
- * TODO.
- */
- protected final Timestamp getTimestamp(final String columnLabel, final Calendar cal) throws SQLException {
+ @Override
+ public final Timestamp getTimestamp(final String columnLabel, final Calendar cal) throws SQLException {
return resultSet.getTimestamp(columnLabel, cal);
}
- /**
- * TODO.
- */
- protected final int getType() throws SQLException {
+ @Override
+ public final int getType() throws SQLException {
return resultSet.getType();
}
- /**
- * TODO.
- */
+ @Override
@Deprecated
- protected final InputStream getUnicodeStream(final int columnIndex) throws SQLException {
+ public final InputStream getUnicodeStream(final int columnIndex) throws SQLException {
return resultSet.getUnicodeStream(columnIndex);
}
- /**
- * TODO.
- */
+ @Override
@Deprecated
- protected final InputStream getUnicodeStream(final String columnLabel) throws SQLException {
+ public final InputStream getUnicodeStream(final String columnLabel) throws SQLException {
return resultSet.getUnicodeStream(columnLabel);
}
- /**
- * TODO.
- */
- protected final URL getURL(final int columnIndex) throws SQLException {
+ @Override
+ public final URL getURL(final int columnIndex) throws SQLException {
return resultSet.getURL(columnIndex);
}
- /**
- * TODO.
- */
- protected final URL getURL(final String columnLabel) throws SQLException {
+ @Override
+ public final URL getURL(final String columnLabel) throws SQLException {
return resultSet.getURL(columnLabel);
}
- /**
- * TODO.
- */
- protected final SQLWarning getWarnings() throws SQLException {
+ @Override
+ public final SQLWarning getWarnings() throws SQLException {
return resultSet.getWarnings();
}
@@ -670,17 +524,12 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
*/
protected abstract T handle() throws SQLException;
- /**
- * TODO.
- */
@Override
- public final T handle(final ResultSet rs) throws SQLException {
+ public final T handle(final ResultSet resultSet) throws SQLException {
if (this.resultSet != null) {
throw new IllegalStateException("Re-entry not allowed!");
}
-
- this.resultSet = rs;
-
+ this.resultSet = resultSet;
try {
return handle();
} finally {
@@ -688,732 +537,540 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
}
}
- /**
- * TODO.
- */
- protected final void insertRow() throws SQLException {
+ @Override
+ public final void insertRow() throws SQLException {
resultSet.insertRow();
}
- /**
- * TODO.
- */
- protected final boolean isAfterLast() throws SQLException {
+ @Override
+ public final boolean isAfterLast() throws SQLException {
return resultSet.isAfterLast();
}
- /**
- * TODO.
- */
- protected final boolean isBeforeFirst() throws SQLException {
+ @Override
+ public final boolean isBeforeFirst() throws SQLException {
return resultSet.isBeforeFirst();
}
- /**
- * TODO.
- */
- protected final boolean isClosed() throws SQLException {
+ @Override
+ public final boolean isClosed() throws SQLException {
return resultSet.isClosed();
}
- /**
- * TODO.
- */
- protected final boolean isFirst() throws SQLException {
+ @Override
+ public final boolean isFirst() throws SQLException {
return resultSet.isFirst();
}
- /**
- * TODO.
- */
- protected final boolean isLast() throws SQLException {
+ @Override
+ public final boolean isLast() throws SQLException {
return resultSet.isLast();
}
- /**
- * TODO.
- */
- protected final boolean isWrapperFor(final Class<?> iface) throws SQLException {
+ @Override
+ public final boolean isWrapperFor(final Class<?> iface) throws SQLException {
return resultSet.isWrapperFor(iface);
}
- /**
- * TODO.
- */
- protected final boolean last() throws SQLException {
+ @Override
+ public final boolean last() throws SQLException {
return resultSet.last();
}
- /**
- * TODO.
- */
- protected final void moveToCurrentRow() throws SQLException {
+ @Override
+ public final void moveToCurrentRow() throws SQLException {
resultSet.moveToCurrentRow();
}
- /**
- * TODO.
- */
- protected final void moveToInsertRow() throws SQLException {
+ @Override
+ public final void moveToInsertRow() throws SQLException {
resultSet.moveToInsertRow();
}
- /**
- * TODO.
- */
- protected final boolean next() throws SQLException {
+ @Override
+ public final boolean next() throws SQLException {
return resultSet.next();
}
- /**
- * TODO.
- */
- protected final boolean previous() throws SQLException {
+ @Override
+ public final boolean previous() throws SQLException {
return resultSet.previous();
}
- /**
- * TODO.
- */
- protected final void refreshRow() throws SQLException {
+ @Override
+ public final void refreshRow() throws SQLException {
resultSet.refreshRow();
}
- /**
- * TODO.
- */
- protected final boolean relative(final int rows) throws SQLException {
+ @Override
+ public final boolean relative(final int rows) throws SQLException {
return resultSet.relative(rows);
}
- /**
- * TODO.
- */
- protected final boolean rowDeleted() throws SQLException {
+ @Override
+ public final boolean rowDeleted() throws SQLException {
return resultSet.rowDeleted();
}
- /**
- * TODO.
- */
- protected final boolean rowInserted() throws SQLException {
+ @Override
+ public final boolean rowInserted() throws SQLException {
return resultSet.rowInserted();
}
- /**
- * TODO.
- */
- protected final boolean rowUpdated() throws SQLException {
+ @Override
+ public final boolean rowUpdated() throws SQLException {
return resultSet.rowUpdated();
}
- /**
- * TODO.
- */
- protected final void setFetchDirection(final int direction) throws SQLException {
+ @Override
+ public final void setFetchDirection(final int direction) throws SQLException {
resultSet.setFetchDirection(direction);
}
- /**
- * TODO.
- */
- protected final void setFetchSize(final int rows) throws SQLException {
+ @Override
+ public final void setFetchSize(final int rows) throws SQLException {
resultSet.setFetchSize(rows);
}
- /**
- * TODO.
- */
- protected final <E> E unwrap(final Class<E> iface) throws SQLException {
+ @Override
+ public final <E> E unwrap(final Class<E> iface) throws SQLException {
return resultSet.unwrap(iface);
}
- /**
- * TODO.
- */
- protected final void updateArray(final int columnIndex, final Array x) throws SQLException {
+ @Override
+ public final void updateArray(final int columnIndex, final Array x) throws SQLException {
resultSet.updateArray(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateArray(final String columnLabel, final Array x) throws SQLException {
+ @Override
+ public final void updateArray(final String columnLabel, final Array x) throws SQLException {
resultSet.updateArray(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateAsciiStream(final int columnIndex, final InputStream x) throws SQLException {
+ @Override
+ public final void updateAsciiStream(final int columnIndex, final InputStream x) throws SQLException {
resultSet.updateAsciiStream(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateAsciiStream(final int columnIndex, final InputStream x, final int length) throws SQLException {
+ @Override
+ public final void updateAsciiStream(final int columnIndex, final InputStream x, final int length) throws SQLException {
resultSet.updateAsciiStream(columnIndex, x, length);
}
- /**
- * TODO.
- */
- protected final void updateAsciiStream(final int columnIndex, final InputStream x, final long length) throws SQLException {
+ @Override
+ public final void updateAsciiStream(final int columnIndex, final InputStream x, final long length) throws SQLException {
resultSet.updateAsciiStream(columnIndex, x, length);
}
- /**
- * TODO.
- */
- protected final void updateAsciiStream(final String columnLabel, final InputStream x) throws SQLException {
+ @Override
+ public final void updateAsciiStream(final String columnLabel, final InputStream x) throws SQLException {
resultSet.updateAsciiStream(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateAsciiStream(final String columnLabel, final InputStream x, final int length) throws SQLException {
+ @Override
+ public final void updateAsciiStream(final String columnLabel, final InputStream x, final int length) throws SQLException {
resultSet.updateAsciiStream(columnLabel, x, length);
}
- /**
- * TODO.
- */
- protected final void updateAsciiStream(final String columnLabel, final InputStream x, final long length) throws SQLException {
+ @Override
+ public final void updateAsciiStream(final String columnLabel, final InputStream x, final long length) throws SQLException {
resultSet.updateAsciiStream(columnLabel, x, length);
}
- /**
- * TODO.
- */
- protected final void updateBigDecimal(final int columnIndex, final BigDecimal x) throws SQLException {
+ @Override
+ public final void updateBigDecimal(final int columnIndex, final BigDecimal x) throws SQLException {
resultSet.updateBigDecimal(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateBigDecimal(final String columnLabel, final BigDecimal x) throws SQLException {
+ @Override
+ public final void updateBigDecimal(final String columnLabel, final BigDecimal x) throws SQLException {
resultSet.updateBigDecimal(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateBinaryStream(final int columnIndex, final InputStream x) throws SQLException {
+ @Override
+ public final void updateBinaryStream(final int columnIndex, final InputStream x) throws SQLException {
resultSet.updateBinaryStream(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateBinaryStream(final int columnIndex, final InputStream x, final int length) throws SQLException {
+ @Override
+ public final void updateBinaryStream(final int columnIndex, final InputStream x, final int length) throws SQLException {
resultSet.updateBinaryStream(columnIndex, x, length);
}
- /**
- * TODO.
- */
- protected final void updateBinaryStream(final int columnIndex, final InputStream x, final long length) throws SQLException {
+ @Override
+ public final void updateBinaryStream(final int columnIndex, final InputStream x, final long length) throws SQLException {
resultSet.updateBinaryStream(columnIndex, x, length);
}
- /**
- * TODO.
- */
- protected final void updateBinaryStream(final String columnLabel, final InputStream x) throws SQLException {
+ @Override
+ public final void updateBinaryStream(final String columnLabel, final InputStream x) throws SQLException {
resultSet.updateBinaryStream(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateBinaryStream(final String columnLabel, final InputStream x, final int length) throws SQLException {
+ @Override
+ public final void updateBinaryStream(final String columnLabel, final InputStream x, final int length) throws SQLException {
resultSet.updateBinaryStream(columnLabel, x, length);
}
- /**
- * TODO.
- */
- protected final void updateBinaryStream(final String columnLabel, final InputStream x, final long length) throws SQLException {
+ @Override
+ public final void updateBinaryStream(final String columnLabel, final InputStream x, final long length) throws SQLException {
resultSet.updateBinaryStream(columnLabel, x, length);
}
- /**
- * TODO.
- */
- protected final void updateBlob(final int columnIndex, final Blob x) throws SQLException {
+ @Override
+ public final void updateBlob(final int columnIndex, final Blob x) throws SQLException {
resultSet.updateBlob(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateBlob(final int columnIndex, final InputStream inputStream) throws SQLException {
+ @Override
+ public final void updateBlob(final int columnIndex, final InputStream inputStream) throws SQLException {
resultSet.updateBlob(columnIndex, inputStream);
}
- /**
- * TODO.
- */
- protected final void updateBlob(final int columnIndex, final InputStream inputStream, final long length) throws SQLException {
+ @Override
+ public final void updateBlob(final int columnIndex, final InputStream inputStream, final long length) throws SQLException {
resultSet.updateBlob(columnIndex, inputStream, length);
}
- /**
- * TODO.
- */
- protected final void updateBlob(final String columnLabel, final Blob x) throws SQLException {
+ @Override
+ public final void updateBlob(final String columnLabel, final Blob x) throws SQLException {
resultSet.updateBlob(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateBlob(final String columnLabel, final InputStream inputStream) throws SQLException {
+ @Override
+ public final void updateBlob(final String columnLabel, final InputStream inputStream) throws SQLException {
resultSet.updateBlob(columnLabel, inputStream);
}
- /**
- * TODO.
- */
- protected final void updateBlob(final String columnLabel, final InputStream inputStream, final long length) throws SQLException {
+ @Override
+ public final void updateBlob(final String columnLabel, final InputStream inputStream, final long length) throws SQLException {
resultSet.updateBlob(columnLabel, inputStream, length);
}
- /**
- * TODO.
- */
- protected final void updateBoolean(final int columnIndex, final boolean x) throws SQLException {
+ @Override
+ public final void updateBoolean(final int columnIndex, final boolean x) throws SQLException {
resultSet.updateBoolean(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateBoolean(final String columnLabel, final boolean x) throws SQLException {
+ @Override
+ public final void updateBoolean(final String columnLabel, final boolean x) throws SQLException {
resultSet.updateBoolean(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateByte(final int columnIndex, final byte x) throws SQLException {
+ @Override
+ public final void updateByte(final int columnIndex, final byte x) throws SQLException {
resultSet.updateByte(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateByte(final String columnLabel, final byte x) throws SQLException {
+ @Override
+ public final void updateByte(final String columnLabel, final byte x) throws SQLException {
resultSet.updateByte(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateBytes(final int columnIndex, final byte[] x) throws SQLException {
+ @Override
+ public final void updateBytes(final int columnIndex, final byte[] x) throws SQLException {
resultSet.updateBytes(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateBytes(final String columnLabel, final byte[] x) throws SQLException {
+ @Override
+ public final void updateBytes(final String columnLabel, final byte[] x) throws SQLException {
resultSet.updateBytes(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateCharacterStream(final int columnIndex, final Reader x) throws SQLException {
+ @Override
+ public final void updateCharacterStream(final int columnIndex, final Reader x) throws SQLException {
resultSet.updateCharacterStream(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateCharacterStream(final int columnIndex, final Reader x, final int length) throws SQLException {
+ @Override
+ public final void updateCharacterStream(final int columnIndex, final Reader x, final int length) throws SQLException {
resultSet.updateCharacterStream(columnIndex, x, length);
}
- /**
- * TODO.
- */
- protected final void updateCharacterStream(final int columnIndex, final Reader x, final long length) throws SQLException {
+ @Override
+ public final void updateCharacterStream(final int columnIndex, final Reader x, final long length) throws SQLException {
resultSet.updateCharacterStream(columnIndex, x, length);
}
- /**
- * TODO.
- */
- protected final void updateCharacterStream(final String columnLabel, final Reader reader) throws SQLException {
+ @Override
+ public final void updateCharacterStream(final String columnLabel, final Reader reader) throws SQLException {
resultSet.updateCharacterStream(columnLabel, reader);
}
- /**
- * TODO.
- */
- protected final void updateCharacterStream(final String columnLabel, final Reader reader, final int length) throws SQLException {
+ @Override
+ public final void updateCharacterStream(final String columnLabel, final Reader reader, final int length) throws SQLException {
resultSet.updateCharacterStream(columnLabel, reader, length);
}
- /**
- * TODO.
- */
- protected final void updateCharacterStream(final String columnLabel, final Reader reader, final long length) throws SQLException {
+ @Override
+ public final void updateCharacterStream(final String columnLabel, final Reader reader, final long length) throws SQLException {
resultSet.updateCharacterStream(columnLabel, reader, length);
}
- /**
- * TODO.
- */
- protected final void updateClob(final int columnIndex, final Clob x) throws SQLException {
+ @Override
+ public final void updateClob(final int columnIndex, final Clob x) throws SQLException {
resultSet.updateClob(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateClob(final int columnIndex, final Reader reader) throws SQLException {
+ @Override
+ public final void updateClob(final int columnIndex, final Reader reader) throws SQLException {
resultSet.updateClob(columnIndex, reader);
}
- /**
- * TODO.
- */
- protected final void updateClob(final int columnIndex, final Reader reader, final long length) throws SQLException {
+ @Override
+ public final void updateClob(final int columnIndex, final Reader reader, final long length) throws SQLException {
resultSet.updateClob(columnIndex, reader, length);
}
- /**
- * TODO.
- */
- protected final void updateClob(final String columnLabel, final Clob x) throws SQLException {
+ @Override
+ public final void updateClob(final String columnLabel, final Clob x) throws SQLException {
resultSet.updateClob(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateClob(final String columnLabel, final Reader reader) throws SQLException {
+ @Override
+ public final void updateClob(final String columnLabel, final Reader reader) throws SQLException {
resultSet.updateClob(columnLabel, reader);
}
- /**
- * TODO.
- */
- protected final void updateClob(final String columnLabel, final Reader reader, final long length) throws SQLException {
+ @Override
+ public final void updateClob(final String columnLabel, final Reader reader, final long length) throws SQLException {
resultSet.updateClob(columnLabel, reader, length);
}
- /**
- * TODO.
- */
- protected final void updateDate(final int columnIndex, final Date x) throws SQLException {
+ @Override
+ public final void updateDate(final int columnIndex, final Date x) throws SQLException {
resultSet.updateDate(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateDate(final String columnLabel, final Date x) throws SQLException {
+ @Override
+ public final void updateDate(final String columnLabel, final Date x) throws SQLException {
resultSet.updateDate(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateDouble(final int columnIndex, final double x) throws SQLException {
+ @Override
+ public final void updateDouble(final int columnIndex, final double x) throws SQLException {
resultSet.updateDouble(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateDouble(final String columnLabel, final double x) throws SQLException {
+ @Override
+ public final void updateDouble(final String columnLabel, final double x) throws SQLException {
resultSet.updateDouble(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateFloat(final int columnIndex, final float x) throws SQLException {
+ @Override
+ public final void updateFloat(final int columnIndex, final float x) throws SQLException {
resultSet.updateFloat(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateFloat(final String columnLabel, final float x) throws SQLException {
+ @Override
+ public final void updateFloat(final String columnLabel, final float x) throws SQLException {
resultSet.updateFloat(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateInt(final int columnIndex, final int x) throws SQLException {
+ @Override
+ public final void updateInt(final int columnIndex, final int x) throws SQLException {
resultSet.updateInt(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateInt(final String columnLabel, final int x) throws SQLException {
+ @Override
+ public final void updateInt(final String columnLabel, final int x) throws SQLException {
resultSet.updateInt(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateLong(final int columnIndex, final long x) throws SQLException {
+ @Override
+ public final void updateLong(final int columnIndex, final long x) throws SQLException {
resultSet.updateLong(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateLong(final String columnLabel, final long x) throws SQLException {
+ @Override
+ public final void updateLong(final String columnLabel, final long x) throws SQLException {
resultSet.updateLong(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateNCharacterStream(final int columnIndex, final Reader x) throws SQLException {
+ @Override
+ public final void updateNCharacterStream(final int columnIndex, final Reader x) throws SQLException {
resultSet.updateNCharacterStream(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateNCharacterStream(final int columnIndex, final Reader x, final long length) throws SQLException {
+ @Override
+ public final void updateNCharacterStream(final int columnIndex, final Reader x, final long length) throws SQLException {
resultSet.updateNCharacterStream(columnIndex, x, length);
}
- /**
- * TODO.
- */
- protected final void updateNCharacterStream(final String columnLabel, final Reader reader) throws SQLException {
+ @Override
+ public final void updateNCharacterStream(final String columnLabel, final Reader reader) throws SQLException {
resultSet.updateNCharacterStream(columnLabel, reader);
}
- /**
- * TODO.
- */
- protected final void updateNCharacterStream(final String columnLabel, final Reader reader, final long length) throws SQLException {
+ @Override
+ public final void updateNCharacterStream(final String columnLabel, final Reader reader, final long length) throws SQLException {
resultSet.updateNCharacterStream(columnLabel, reader, length);
}
- /**
- * TODO.
- */
- protected final void updateNClob(final int columnIndex, final NClob nClob) throws SQLException {
+ @Override
+ public final void updateNClob(final int columnIndex, final NClob nClob) throws SQLException {
resultSet.updateNClob(columnIndex, nClob);
}
- /**
- * TODO.
- */
- protected final void updateNClob(final int columnIndex, final Reader reader) throws SQLException {
+ @Override
+ public final void updateNClob(final int columnIndex, final Reader reader) throws SQLException {
resultSet.updateNClob(columnIndex, reader);
}
- /**
- * TODO.
- */
- protected final void updateNClob(final int columnIndex, final Reader reader, final long length) throws SQLException {
+ @Override
+ public final void updateNClob(final int columnIndex, final Reader reader, final long length) throws SQLException {
resultSet.updateNClob(columnIndex, reader, length);
}
- /**
- * TODO.
- */
- protected final void updateNClob(final String columnLabel, final NClob nClob) throws SQLException {
+ @Override
+ public final void updateNClob(final String columnLabel, final NClob nClob) throws SQLException {
resultSet.updateNClob(columnLabel, nClob);
}
- /**
- * TODO.
- */
- protected final void updateNClob(final String columnLabel, final Reader reader) throws SQLException {
+ @Override
+ public final void updateNClob(final String columnLabel, final Reader reader) throws SQLException {
resultSet.updateNClob(columnLabel, reader);
}
- /**
- * TODO.
- */
- protected final void updateNClob(final String columnLabel, final Reader reader, final long length) throws SQLException {
+ @Override
+ public final void updateNClob(final String columnLabel, final Reader reader, final long length) throws SQLException {
resultSet.updateNClob(columnLabel, reader, length);
}
- /**
- * TODO.
- */
- protected final void updateNString(final int columnIndex, final String nString) throws SQLException {
+ @Override
+ public final void updateNString(final int columnIndex, final String nString) throws SQLException {
resultSet.updateNString(columnIndex, nString);
}
- /**
- * TODO.
- */
- protected final void updateNString(final String columnLabel, final String nString) throws SQLException {
+ @Override
+ public final void updateNString(final String columnLabel, final String nString) throws SQLException {
resultSet.updateNString(columnLabel, nString);
}
- /**
- * TODO.
- */
- protected final void updateNull(final int columnIndex) throws SQLException {
+ @Override
+ public final void updateNull(final int columnIndex) throws SQLException {
resultSet.updateNull(columnIndex);
}
- /**
- * TODO.
- */
- protected final void updateNull(final String columnLabel) throws SQLException {
+ @Override
+ public final void updateNull(final String columnLabel) throws SQLException {
resultSet.updateNull(columnLabel);
}
- /**
- * TODO.
- */
- protected final void updateObject(final int columnIndex, final Object x) throws SQLException {
+ @Override
+ public final void updateObject(final int columnIndex, final Object x) throws SQLException {
resultSet.updateObject(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateObject(final int columnIndex, final Object x, final int scaleOrLength) throws SQLException {
+ @Override
+ public final void updateObject(final int columnIndex, final Object x, final int scaleOrLength) throws SQLException {
resultSet.updateObject(columnIndex, x, scaleOrLength);
}
- /**
- * TODO.
- */
- protected final void updateObject(final String columnLabel, final Object x) throws SQLException {
+ public final void updateObject(int columnIndex, Object x, SQLType targetSqlType) throws SQLException {
+ resultSet.updateObject(columnIndex, x, targetSqlType);
+ }
+
+ public final void updateObject(int columnIndex, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException {
+ resultSet.updateObject(columnIndex, x, targetSqlType, scaleOrLength);
+ }
+
+ @Override
+ public final void updateObject(final String columnLabel, final Object x) throws SQLException {
resultSet.updateObject(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateObject(final String columnLabel, final Object x, final int scaleOrLength) throws SQLException {
+ @Override
+ public final void updateObject(final String columnLabel, final Object x, final int scaleOrLength) throws SQLException {
resultSet.updateObject(columnLabel, x, scaleOrLength);
}
- /**
- * TODO.
- */
- protected final void updateRef(final int columnIndex, final Ref x) throws SQLException {
+ public final void updateObject(String columnLabel, Object x, SQLType targetSqlType) throws SQLException {
+ resultSet.updateObject(columnLabel, x, targetSqlType);
+ }
+
+ public final void updateObject(String columnLabel, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException {
+ resultSet.updateObject(columnLabel, x, targetSqlType, scaleOrLength);
+ }
+
+ @Override
+ public final void updateRef(final int columnIndex, final Ref x) throws SQLException {
resultSet.updateRef(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateRef(final String columnLabel, final Ref x) throws SQLException {
+ @Override
+ public final void updateRef(final String columnLabel, final Ref x) throws SQLException {
resultSet.updateRef(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateRow() throws SQLException {
+ @Override
+ public final void updateRow() throws SQLException {
resultSet.updateRow();
}
- /**
- * TODO.
- */
- protected final void updateRowId(final int columnIndex, final RowId x) throws SQLException {
+ @Override
+ public final void updateRowId(final int columnIndex, final RowId x) throws SQLException {
resultSet.updateRowId(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateRowId(final String columnLabel, final RowId x) throws SQLException {
+ @Override
+ public final void updateRowId(final String columnLabel, final RowId x) throws SQLException {
resultSet.updateRowId(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateShort(final int columnIndex, final short x) throws SQLException {
+ @Override
+ public final void updateShort(final int columnIndex, final short x) throws SQLException {
resultSet.updateShort(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateShort(final String columnLabel, final short x) throws SQLException {
+ @Override
+ public final void updateShort(final String columnLabel, final short x) throws SQLException {
resultSet.updateShort(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateSQLXML(final int columnIndex, final SQLXML xmlObject) throws SQLException {
+ @Override
+ public final void updateSQLXML(final int columnIndex, final SQLXML xmlObject) throws SQLException {
resultSet.updateSQLXML(columnIndex, xmlObject);
}
- /**
- * TODO.
- */
- protected final void updateSQLXML(final String columnLabel, final SQLXML xmlObject) throws SQLException {
+ @Override
+ public final void updateSQLXML(final String columnLabel, final SQLXML xmlObject) throws SQLException {
resultSet.updateSQLXML(columnLabel, xmlObject);
}
- /**
- * TODO.
- */
- protected final void updateString(final int columnIndex, final String x) throws SQLException {
+ @Override
+ public final void updateString(final int columnIndex, final String x) throws SQLException {
resultSet.updateString(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateString(final String columnLabel, final String x) throws SQLException {
+ @Override
+ public final void updateString(final String columnLabel, final String x) throws SQLException {
resultSet.updateString(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateTime(final int columnIndex, final Time x) throws SQLException {
+ @Override
+ public final void updateTime(final int columnIndex, final Time x) throws SQLException {
resultSet.updateTime(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateTime(final String columnLabel, final Time x) throws SQLException {
+ @Override
+ public final void updateTime(final String columnLabel, final Time x) throws SQLException {
resultSet.updateTime(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final void updateTimestamp(final int columnIndex, final Timestamp x) throws SQLException {
+ @Override
+ public final void updateTimestamp(final int columnIndex, final Timestamp x) throws SQLException {
resultSet.updateTimestamp(columnIndex, x);
}
- /**
- * TODO.
- */
- protected final void updateTimestamp(final String columnLabel, final Timestamp x) throws SQLException {
+ @Override
+ public final void updateTimestamp(final String columnLabel, final Timestamp x) throws SQLException {
resultSet.updateTimestamp(columnLabel, x);
}
- /**
- * TODO.
- */
- protected final boolean wasNull() throws SQLException {
+ @Override
+ public final boolean wasNull() throws SQLException {
return resultSet.wasNull();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/apache/commons/dbutils/BaseResultSetHandlerDelegationTest.java b/src/test/java/org/apache/commons/dbutils/BaseResultSetHandlerDelegationTest.java
new file mode 100644
index 0000000..15df920
--- /dev/null
+++ b/src/test/java/org/apache/commons/dbutils/BaseResultSetHandlerDelegationTest.java
@@ -0,0 +1,1677 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.commons.dbutils;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.RowId;
+import java.sql.SQLException;
+import java.sql.SQLType;
+import java.sql.SQLXML;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests {@link BaseResultSetHandler} delegation.
+ */
+public class BaseResultSetHandlerDelegationTest extends BaseTestCase {
+
+ private Array array;
+ private final BigDecimal bigDecimal = BigDecimal.ONE;
+ private Blob blob;
+ private boolean booleanValue;
+ private final byte[] byteArray = {};
+ private byte byteValue;
+ private final Calendar cal = Calendar.getInstance();
+ private Clob clob;
+ private int columnIndex;
+ private final String columnLabel = COLUMN_NAMES[0];
+ private final Date date = new Date(1);
+ private int direction;
+ private double doubleValue;
+ private float floatValue;
+ private final Class<?> iface = String.class;
+ private InputStream inputStream;
+ private int intValue;
+ private int lengthInt;
+ private long lengthLong;
+ private long longValue;
+ private final Map<String, Class<?>> map = new HashMap<>();
+ private NClob nClob;
+ private final String nString = "";
+ private final Object object = new Object();
+ private Reader reader;
+ private Ref ref;
+ private int row;
+ private RowId rowId;
+ private int rows;
+ private int scale;
+ private int scaleOrLength;
+ private short shortValue;
+ private final String string = "";
+ private SQLType targetSqlType;
+ private final Time time = new Time(1);
+ private final Timestamp timestamp = new Timestamp(1);
+ private final Class<?> type = String.class;
+ private SQLXML xmlObject;
+
+ private void assertNextRow() throws SQLException {
+ assertTrue(getResultSet().next());
+ }
+
+ @Override
+ protected ResultSet createEmptyMockResultSet() {
+ return MockResultSet.create(META_DATA, null, true);
+ }
+
+ /**
+ * Creates a freshly initialized ResultSet.
+ *
+ * @return a freshly initialized ResultSet.
+ */
+ @Override
+ protected ResultSet createMockResultSet() {
+ return MockResultSet.create(META_DATA, ROW_ARRAY, true);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testAbsolute() throws SQLException {
+ getResultSet().absolute(row);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testAfterLast() throws SQLException {
+ getResultSet().afterLast();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testBeforeFirst() throws SQLException {
+ getResultSet().beforeFirst();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testCancelRowUpdates() throws SQLException {
+ getResultSet().cancelRowUpdates();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testClearWarnings() throws SQLException {
+ getResultSet().clearWarnings();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testClose() throws SQLException {
+ getResultSet().close();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testDeleteRow() throws SQLException {
+ getResultSet().deleteRow();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testFindColumn() throws SQLException {
+ getResultSet().findColumn(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testFirst() throws SQLException {
+ getResultSet().first();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetArrayInt() throws SQLException {
+ getResultSet().getArray(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetArrayString() throws SQLException {
+ getResultSet().getArray(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetAsciiStream() throws SQLException {
+ getResultSet().getAsciiStream(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetAsciiStreamInt() throws SQLException {
+ getResultSet().getAsciiStream(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetBigDecimalInt() throws SQLException {
+ getResultSet().getBigDecimal(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetBigDecimalIntInt() throws SQLException {
+ getResultSet().getBigDecimal(columnIndex, scale);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetBigDecimalString() throws SQLException {
+ getResultSet().getBigDecimal(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetBigDecimalStringInt() throws SQLException {
+ getResultSet().getBigDecimal(columnLabel, scale);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetBinaryStreamInt() throws SQLException {
+ getResultSet().getBinaryStream(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetBinaryStreamString() throws SQLException {
+ getResultSet().getBinaryStream(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetBlobInt() throws SQLException {
+ getResultSet().getBlob(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetBlobString() throws SQLException {
+ getResultSet().getBlob(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetBoolean() throws SQLException {
+ assertNextRow();
+ getResultSet().getBoolean(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetBooleanInt() throws SQLException {
+ getResultSet().getBoolean(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetByteInt() throws SQLException {
+ getResultSet().getByte(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetBytesInt() throws SQLException {
+ getResultSet().getBytes(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetBytesString() throws SQLException {
+ getResultSet().getBytes(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetByteString() throws SQLException {
+ assertNextRow();
+ getResultSet().getByte(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetCharacterStream() throws SQLException {
+ getResultSet().getCharacterStream(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetCharacterStreamInt() throws SQLException {
+ getResultSet().getCharacterStream(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetClob() throws SQLException {
+ getResultSet().getClob(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetClobInt() throws SQLException {
+ getResultSet().getClob(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetConcurrency() throws SQLException {
+ getResultSet().getConcurrency();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetCursorName() throws SQLException {
+ getResultSet().getCursorName();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetDate() throws SQLException {
+ getResultSet().getDate(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetDateInt() throws SQLException {
+ getResultSet().getDate(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetDateIntCalendar() throws SQLException {
+ getResultSet().getDate(columnIndex, cal);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetDateStringCalendar() throws SQLException {
+ getResultSet().getDate(columnLabel, cal);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetDouble() throws SQLException {
+ assertNextRow();
+ getResultSet().getDouble(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetDoubleInt() throws SQLException {
+ getResultSet().getDouble(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetFetchDirection() throws SQLException {
+ getResultSet().getFetchDirection();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetFetchSize() throws SQLException {
+ getResultSet().getFetchSize();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetFloat() throws SQLException {
+ assertNextRow();
+ getResultSet().getFloat(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetFloatInt() throws SQLException {
+ getResultSet().getFloat(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetHoldability() throws SQLException {
+ getResultSet().getHoldability();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetInt() throws SQLException {
+ assertNextRow();
+ getResultSet().getInt(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetIntInt() throws SQLException {
+ getResultSet().getInt(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetLong() throws SQLException {
+ assertNextRow();
+ getResultSet().getLong(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetLongInt() throws SQLException {
+ getResultSet().getLong(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetMetaData() throws SQLException {
+ getResultSet().getMetaData();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetNCharacterStream() throws SQLException {
+ getResultSet().getNCharacterStream(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetNCharacterStreamInt() throws SQLException {
+ getResultSet().getNCharacterStream(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetNClob() throws SQLException {
+ getResultSet().getNClob(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetNClobInt() throws SQLException {
+ getResultSet().getNClob(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetNString() throws SQLException {
+ getResultSet().getNString(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetNStringInt() throws SQLException {
+ getResultSet().getNString(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetObject() throws SQLException {
+ assertNextRow();
+ getResultSet().getObject(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetObjectInt() throws SQLException {
+ getResultSet().getObject(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetObjectIntClass() throws SQLException {
+ getResultSet().getObject(columnIndex, type);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetObjectIntMap() throws SQLException {
+ getResultSet().getObject(columnIndex, map);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetObjectStringClass() throws SQLException {
+ assertNextRow();
+ getResultSet().getObject(columnLabel, type);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetObjectStringMap() throws SQLException {
+ assertNextRow();
+ getResultSet().getObject(columnLabel, map);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetRef() throws SQLException {
+ getResultSet().getRef(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetRefInt() throws SQLException {
+ getResultSet().getRef(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetRow() throws SQLException {
+ getResultSet().getRow();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetRowId() throws SQLException {
+ getResultSet().getRowId(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetRowIdInt() throws SQLException {
+ getResultSet().getRowId(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetShort() throws SQLException {
+ assertNextRow();
+ getResultSet().getShort(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetShortInt() throws SQLException {
+ getResultSet().getShort(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetSQLXML() throws SQLException {
+ getResultSet().getSQLXML(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetSQLXMLInt() throws SQLException {
+ getResultSet().getSQLXML(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetStatement() throws SQLException {
+ getResultSet().getStatement();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetString() throws SQLException {
+ assertNextRow();
+ getResultSet().getString(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetStringInt() throws SQLException {
+ getResultSet().getString(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetTime() throws SQLException {
+ getResultSet().getTime(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetTimeInt() throws SQLException {
+ getResultSet().getTime(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetTimeIntCalendar() throws SQLException {
+ getResultSet().getTime(columnIndex, cal);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetTimestamp() throws SQLException {
+ getResultSet().getTimestamp(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetTimestampInt() throws SQLException {
+ getResultSet().getTimestamp(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetTimestampIntCalendar() throws SQLException {
+ getResultSet().getTimestamp(columnIndex, cal);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetTimestampStringCalendar() throws SQLException {
+ getResultSet().getTimestamp(columnLabel, cal);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetTimeStringCalendar() throws SQLException {
+ getResultSet().getTime(columnLabel, cal);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetType() throws SQLException {
+ getResultSet().getType();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetUnicodeStream() throws SQLException {
+ getResultSet().getUnicodeStream(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetUnicodeStreamInt() throws SQLException {
+ getResultSet().getUnicodeStream(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetURL() throws SQLException {
+ getResultSet().getURL(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetURLInt() throws SQLException {
+ getResultSet().getURL(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testGetWarnings() throws SQLException {
+ getResultSet().getWarnings();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testInsertRow() throws SQLException {
+ getResultSet().insertRow();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testIsAfterLast() throws SQLException {
+ getResultSet().isAfterLast();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testIsBeforeFirst() throws SQLException {
+ getResultSet().isBeforeFirst();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testIsClosed() throws SQLException {
+ getResultSet().isClosed();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testIsFirst() throws SQLException {
+ getResultSet().isFirst();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testIsLast() throws SQLException {
+ getResultSet().isLast();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testIsWrapperFor() throws SQLException {
+ getResultSet().isWrapperFor(iface);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testLast() throws SQLException {
+ getResultSet().last();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testMoveToInsertRow() throws SQLException {
+ getResultSet().moveToInsertRow();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testNext() throws SQLException {
+ assertNextRow();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testPrevious() throws SQLException {
+ getResultSet().previous();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testRefreshRow() throws SQLException {
+ getResultSet().refreshRow();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testRelativeInt() throws SQLException {
+ getResultSet().relative(rows);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testRowDeleted() throws SQLException {
+ getResultSet().rowDeleted();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testRowInserted() throws SQLException {
+ getResultSet().rowInserted();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testRowUpdated() throws SQLException {
+ getResultSet().rowUpdated();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testSetFetchDirectionInt() throws SQLException {
+ getResultSet().setFetchDirection(direction);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testSetFetchSizeInt() throws SQLException {
+ getResultSet().setFetchSize(rows);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testTest_moveToCurrentRow() throws SQLException {
+ getResultSet().moveToCurrentRow();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUnwrapClass() throws SQLException {
+ getResultSet().unwrap(iface);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateArrayIntArray() throws SQLException {
+ getResultSet().updateArray(columnIndex, array);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateArrayStringArray() throws SQLException {
+ getResultSet().updateArray(columnLabel, array);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateAsciiStreamIntInputStream() throws SQLException {
+ getResultSet().updateAsciiStream(columnIndex, inputStream);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateAsciiStreamIntInputStreamInt() throws SQLException {
+ getResultSet().updateAsciiStream(columnIndex, inputStream, lengthInt);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateAsciiStreamIntInputStreamLong() throws SQLException {
+ getResultSet().updateAsciiStream(columnIndex, inputStream, lengthLong);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateAsciiStreamStringInputStream() throws SQLException {
+ getResultSet().updateAsciiStream(columnLabel, inputStream);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateAsciiStreamStringInputStreamInt() throws SQLException {
+ getResultSet().updateAsciiStream(columnLabel, inputStream, lengthInt);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateAsciiStreamStringInputStreamLong() throws SQLException {
+ getResultSet().updateAsciiStream(columnLabel, inputStream, lengthLong);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBigDecimalIntBigDecimal() throws SQLException {
+ getResultSet().updateBigDecimal(columnIndex, bigDecimal);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBigDecimalStringBigDecimal() throws SQLException {
+ getResultSet().updateBigDecimal(columnLabel, bigDecimal);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBinaryStreamIntInputStream() throws SQLException {
+ getResultSet().updateBinaryStream(columnIndex, inputStream);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBinaryStreamIntInputStreamInt() throws SQLException {
+ getResultSet().updateBinaryStream(columnIndex, inputStream, lengthInt);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBinaryStreamIntInputStreamLong() throws SQLException {
+ getResultSet().updateBinaryStream(columnIndex, inputStream, lengthLong);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBinaryStreamStringInputStream() throws SQLException {
+ getResultSet().updateBinaryStream(columnLabel, inputStream);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBinaryStreamStringInputStreamInt() throws SQLException {
+ getResultSet().updateBinaryStream(columnLabel, inputStream, lengthInt);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBinaryStreamStringInputStreamLong() throws SQLException {
+ getResultSet().updateBinaryStream(columnLabel, inputStream, lengthLong);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBlobIntBlob() throws SQLException {
+ getResultSet().updateBlob(columnIndex, blob);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBlobIntInputStream() throws SQLException {
+ getResultSet().updateBlob(columnIndex, inputStream);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBlobIntInputStreamLong() throws SQLException {
+ getResultSet().updateBlob(columnIndex, inputStream, lengthLong);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBlobStringBlob() throws SQLException {
+ getResultSet().updateBlob(columnLabel, blob);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBlobStringInputStream() throws SQLException {
+ getResultSet().updateBlob(columnLabel, inputStream);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBlobStringInputStreamLong() throws SQLException {
+ getResultSet().updateBlob(columnLabel, inputStream, lengthLong);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBooleanIntBoolean() throws SQLException {
+ getResultSet().updateBoolean(columnIndex, booleanValue);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBooleanStringBoolean() throws SQLException {
+ getResultSet().updateBoolean(columnLabel, booleanValue);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateByteIntByte() throws SQLException {
+ getResultSet().updateByte(columnIndex, byteValue);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBytesIntByteArray() throws SQLException {
+ getResultSet().updateBytes(columnIndex, byteArray);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateBytesStringByteArray() throws SQLException {
+ getResultSet().updateBytes(columnLabel, byteArray);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateByteStringByte() throws SQLException {
+ getResultSet().updateByte(columnLabel, byteValue);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateCharacterStreamIntReader() throws SQLException {
+ getResultSet().updateCharacterStream(columnIndex, reader);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateCharacterStreamIntReaderInt() throws SQLException {
+ getResultSet().updateCharacterStream(columnIndex, reader, lengthInt);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateCharacterStreamIntReaderLong() throws SQLException {
+ getResultSet().updateCharacterStream(columnIndex, reader, lengthLong);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateCharacterStreamStringReader() throws SQLException {
+ getResultSet().updateCharacterStream(columnLabel, reader);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateCharacterStreamStringReaderInt() throws SQLException {
+ getResultSet().updateCharacterStream(columnLabel, reader, lengthInt);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateCharacterStreamStringReaderLong() throws SQLException {
+ getResultSet().updateCharacterStream(columnLabel, reader, lengthLong);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateClobIntClob() throws SQLException {
+ getResultSet().updateClob(columnIndex, clob);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateClobIntReader() throws SQLException {
+ getResultSet().updateClob(columnIndex, reader);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateClobIntReaderLong() throws SQLException {
+ getResultSet().updateClob(columnIndex, reader, lengthLong);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateClobStringClob() throws SQLException {
+ getResultSet().updateClob(columnLabel, clob);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateClobStringReader() throws SQLException {
+ getResultSet().updateClob(columnLabel, reader);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateClobStringReaderLong() throws SQLException {
+ getResultSet().updateClob(columnLabel, reader, lengthLong);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateDateIntDate() throws SQLException {
+ getResultSet().updateDate(columnIndex, date);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateDateStringDate() throws SQLException {
+ getResultSet().updateDate(columnLabel, date);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateDoubleIntDouble() throws SQLException {
+ getResultSet().updateDouble(columnIndex, doubleValue);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateDoubleStringDouble() throws SQLException {
+ getResultSet().updateDouble(columnLabel, doubleValue);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateFloatIntFloat() throws SQLException {
+ getResultSet().updateFloat(columnIndex, floatValue);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateFloatStringFloat() throws SQLException {
+ getResultSet().updateFloat(columnLabel, floatValue);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateIntIntInt() throws SQLException {
+ getResultSet().updateInt(columnIndex, intValue);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateIntStringInt() throws SQLException {
+ getResultSet().updateInt(columnLabel, intValue);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateLongIntLong() throws SQLException {
+ getResultSet().updateLong(columnIndex, longValue);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateLongStringLong() throws SQLException {
+ getResultSet().updateLong(columnLabel, longValue);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateNCharacterStreamIntReader() throws SQLException {
+ getResultSet().updateNCharacterStream(columnIndex, reader);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateNCharacterStreamIntReaderLong() throws SQLException {
+ getResultSet().updateNCharacterStream(columnIndex, reader, lengthLong);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateNCharacterStreamStringReader() throws SQLException {
+ getResultSet().updateNCharacterStream(columnLabel, reader);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateNCharacterStreamStringReaderLong() throws SQLException {
+ getResultSet().updateNCharacterStream(columnLabel, reader, lengthLong);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateNClobIntNClob() throws SQLException {
+ getResultSet().updateNClob(columnIndex, nClob);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateNClobIntReader() throws SQLException {
+ getResultSet().updateNClob(columnIndex, reader);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateNClobIntReaderLong() throws SQLException {
+ getResultSet().updateNClob(columnIndex, reader, lengthLong);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateNClobStringNClob() throws SQLException {
+ getResultSet().updateNClob(columnLabel, nClob);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateNClobStringReader() throws SQLException {
+ getResultSet().updateNClob(columnLabel, reader);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateNClobStringReaderLong() throws SQLException {
+ getResultSet().updateNClob(columnLabel, reader, lengthLong);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateNStringIntString() throws SQLException {
+ getResultSet().updateNString(columnIndex, nString);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateNStringStringString() throws SQLException {
+ getResultSet().updateNString(columnLabel, nString);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateNull() throws SQLException {
+ getResultSet().updateNull(columnLabel);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateNullInt() throws SQLException {
+ getResultSet().updateNull(columnIndex);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateObjectInObjectInt() throws SQLException {
+ getResultSet().updateObject(columnIndex, object, scaleOrLength);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateObjectIntObject() throws SQLException {
+ getResultSet().updateObject(columnIndex, object);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateObjectIntObjectSQLType() throws SQLException {
+ getResultSet().updateObject(columnIndex, object, targetSqlType);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateObjectIntObjectSQLTypeInt() throws SQLException {
+ getResultSet().updateObject(columnIndex, object, targetSqlType, scaleOrLength);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateObjectStringObject() throws SQLException {
+ getResultSet().updateObject(columnLabel, object);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateObjectStringObjectInt() throws SQLException {
+ getResultSet().updateObject(columnLabel, object, scaleOrLength);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateObjectStringObjectSQLType() throws SQLException {
+ getResultSet().updateObject(columnLabel, object, targetSqlType);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateObjectStringObjectSQLTypeInt() throws SQLException {
+ getResultSet().updateObject(columnLabel, object, targetSqlType, scaleOrLength);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateRefIntRef() throws SQLException {
+ getResultSet().updateRef(columnIndex, ref);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateRefStringRef() throws SQLException {
+ getResultSet().updateRef(columnLabel, ref);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateRow() throws SQLException {
+ getResultSet().updateRow();
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateRowIdIntRowId() throws SQLException {
+ getResultSet().updateRowId(columnIndex, rowId);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateRowIdStringRowId() throws SQLException {
+ getResultSet().updateRowId(columnLabel, rowId);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateShortIntShort() throws SQLException {
+ getResultSet().updateShort(columnIndex, shortValue);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateShortStringShort() throws SQLException {
+ getResultSet().updateShort(columnLabel, shortValue);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateSQLXMLIntSQLXML() throws SQLException {
+ getResultSet().updateSQLXML(columnIndex, xmlObject);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateSQLXMLStringSQLXML() throws SQLException {
+ getResultSet().updateSQLXML(columnLabel, xmlObject);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateStringIntString() throws SQLException {
+ getResultSet().updateString(columnIndex, string);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateStringStringString() throws SQLException {
+ getResultSet().updateString(columnLabel, string);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateTimeIntTime() throws SQLException {
+ getResultSet().updateTime(columnIndex, time);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateTimestampIntTimestamp() throws SQLException {
+ getResultSet().updateTimestamp(columnIndex, timestamp);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateTimestampStringTimestamp() throws SQLException {
+ getResultSet().updateTimestamp(columnLabel, timestamp);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testUpdateTimeStringTime() throws SQLException {
+ getResultSet().updateTime(columnLabel, time);
+ }
+
+ /**
+ * Tests delegation.
+ */
+ @Test
+ public void testWasNull() throws SQLException {
+ getResultSet().wasNull();
+ }
+}
diff --git a/src/test/java/org/apache/commons/dbutils/BaseResultSetHandlerTest.java b/src/test/java/org/apache/commons/dbutils/BaseResultSetHandlerHandleTest.java
similarity index 88%
rename from src/test/java/org/apache/commons/dbutils/BaseResultSetHandlerTest.java
rename to src/test/java/org/apache/commons/dbutils/BaseResultSetHandlerHandleTest.java
index e36f0d3..11bab80 100644
--- a/src/test/java/org/apache/commons/dbutils/BaseResultSetHandlerTest.java
+++ b/src/test/java/org/apache/commons/dbutils/BaseResultSetHandlerHandleTest.java
@@ -14,9 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.dbutils;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.sql.SQLException;
@@ -27,35 +29,32 @@ import java.util.Map;
import org.junit.jupiter.api.Test;
-public final class BaseResultSetHandlerTest extends BaseTestCase {
+/**
+ * Tests {@link BaseResultSetHandler}.
+ */
+public final class BaseResultSetHandlerHandleTest extends BaseTestCase {
- private static final class ToMapCollectionHandler extends BaseResultSetHandler<Collection<Map<String, Object>>> {
+ static final class ToMapCollectionHandler extends BaseResultSetHandler<Collection<Map<String, Object>>> {
@Override
protected Collection<Map<String, Object>> handle() throws SQLException {
+ assertNotNull(getAdaptedResultSet());
final Collection<Map<String, Object>> result = new LinkedList<>();
-
while (next()) {
final Map<String, Object> current = new HashMap<>();
-
for (int i = 1; i <= getMetaData().getColumnCount(); i++) {
current.put(getMetaData().getColumnName(i), getObject(i));
}
-
result.add(current);
}
-
return result;
}
-
}
@Test
public void testHandleWithoutExplicitResultSetInvocation() throws Exception {
final Collection<Map<String, Object>> result = new ToMapCollectionHandler().handle(createMockResultSet());
-
assertFalse(result.isEmpty());
-
for (final Map<String, Object> current : result) {
assertTrue(current.containsKey("one"));
assertTrue(current.containsKey("two"));
@@ -69,5 +68,4 @@ public final class BaseResultSetHandlerTest extends BaseTestCase {
assertTrue(current.containsKey("columnProcessorDoubleTest"));
}
}
-
}
diff --git a/src/test/java/org/apache/commons/dbutils/BaseTestCase.java b/src/test/java/org/apache/commons/dbutils/BaseTestCase.java
index 66d8a59..d5df0ca 100644
--- a/src/test/java/org/apache/commons/dbutils/BaseTestCase.java
+++ b/src/test/java/org/apache/commons/dbutils/BaseTestCase.java
@@ -33,66 +33,72 @@ import org.junit.jupiter.api.Test;
*/
public class BaseTestCase {
- private static final String[] columnNames = { "one", "two", "three", "notInBean", "intTest", "integerTest", "nullObjectTest", "nullPrimitiveTest",
+ protected static final String[] COLUMN_NAMES = { "one", "two", "three", "notInBean", "intTest", "integerTest", "nullObjectTest", "nullPrimitiveTest",
"notDate", "columnProcessorDoubleTest", null };
/**
* The number of columns in the MockResultSet.
*/
- protected static final int COLS = columnNames.length;
+ protected static final int COLUMN_COUNT = COLUMN_NAMES.length;
- protected static final ResultSetMetaData metaData = MockResultSetMetaData.create(columnNames);
+ protected static final ResultSetMetaData META_DATA = MockResultSetMetaData.create(COLUMN_NAMES);
/**
* A Timestamp for test purposes having 9 decimals
*/
- static final Timestamp ts789456123;
+ static final Timestamp TS_789456123;
static {
- ts789456123 = new Timestamp(new Date().getTime());
- ts789456123.setNanos(789456123);
+ TS_789456123 = new Timestamp(new Date().getTime());
+ TS_789456123.setNanos(789456123);
}
private static final Object[] row1 = { "1", "2", "THREE", " notInBean ", Integer.valueOf(1), Integer.valueOf(2), null, null, new Date(),
BigInteger.valueOf(13), null };
- private static final Object[] row2 = { "4", "5", "SIX", " notInBean ", Integer.valueOf(3), Integer.valueOf(4), null, null, ts789456123,
+ private static final Object[] row2 = { "4", "5", "SIX", " notInBean ", Integer.valueOf(3), Integer.valueOf(4), null, null, TS_789456123,
BigInteger.valueOf(13), null };
- private static final Object[][] rows = { row1, row2 };
+ protected static final Object[][] ROW_ARRAY = { row1, row2 };
/**
* The number of rows in the MockResultSet.
*/
- protected static final int ROWS = rows.length;
+ protected static final int ROW_COUNT = ROW_ARRAY.length;
/**
* The ResultSet all test methods will use.
*/
- private ResultSet rs;
+ private ResultSet resultSet;
/**
* A ResultSet with 0 rows.
*/
private ResultSet emptyResultSet;
+ protected ResultSet createEmptyMockResultSet() {
+ return MockResultSet.create(META_DATA, null, false);
+ }
+
/**
* Creates a freshly initialized ResultSet.
+ *
+ * @return a freshly initialized ResultSet.
*/
protected ResultSet createMockResultSet() {
- return MockResultSet.create(metaData, rows);
+ return MockResultSet.create(META_DATA, ROW_ARRAY, false);
}
public ResultSet getEmptyResultSet() {
- return this.emptyResultSet;
+ return emptyResultSet;
}
public ResultSet getResultSet() {
- return this.rs;
+ return resultSet;
}
public void setResultSet(final ResultSet resultSet) {
- this.rs = resultSet;
+ this.resultSet = resultSet;
}
/**
@@ -102,16 +108,16 @@ public class BaseTestCase {
*/
@BeforeEach
protected void setUp() throws Exception {
- rs = createMockResultSet();
- emptyResultSet = MockResultSet.create(metaData, null);
+ resultSet = createMockResultSet();
+ emptyResultSet = createEmptyMockResultSet();
}
// Test which allows Eclipse to be run on full project (avoids no tests found)
// check that the rows are valid for the column definition
@Test
public void testCheckDataSizes() {
- assertEquals(columnNames.length, row1.length, "Row 1 must contain correct number of columns");
- assertEquals(columnNames.length, row2.length, "Row 1 must contain correct number of columns");
+ assertEquals(COLUMN_NAMES.length, row1.length, "Row 1 must contain correct number of columns");
+ assertEquals(COLUMN_NAMES.length, row2.length, "Row 1 must contain correct number of columns");
}
@Test
diff --git a/src/test/java/org/apache/commons/dbutils/BasicRowProcessorTest.java b/src/test/java/org/apache/commons/dbutils/BasicRowProcessorTest.java
index 4df7f96..24cba08 100644
--- a/src/test/java/org/apache/commons/dbutils/BasicRowProcessorTest.java
+++ b/src/test/java/org/apache/commons/dbutils/BasicRowProcessorTest.java
@@ -70,14 +70,14 @@ public class BasicRowProcessorTest extends BaseTestCase {
Object[] a;
assertTrue(getResultSet().next());
a = processor.toArray(getResultSet());
- assertEquals(COLS, a.length);
+ assertEquals(COLUMN_COUNT, a.length);
assertEquals("1", a[0]);
assertEquals("2", a[1]);
assertEquals("THREE", a[2]);
assertTrue(getResultSet().next());
a = processor.toArray(getResultSet());
- assertEquals(COLS, a.length);
+ assertEquals(COLUMN_COUNT, a.length);
assertEquals("4", a[0]);
assertEquals("5", a[1]);
@@ -121,7 +121,7 @@ public class BasicRowProcessorTest extends BaseTestCase {
final List<TestBean> list = processor.toBeanList(getResultSet(), TestBean.class);
assertNotNull(list);
- assertEquals(ROWS, list.size());
+ assertEquals(ROW_COUNT, list.size());
TestBean b = list.get(0);
assertEquals("1", b.getOne());
@@ -150,14 +150,14 @@ public class BasicRowProcessorTest extends BaseTestCase {
assertTrue(getResultSet().next());
Map<String, Object> m = processor.toMap(getResultSet());
- assertEquals(COLS, m.size());
+ assertEquals(COLUMN_COUNT, m.size());
assertEquals("1", m.get("one"));
assertEquals("2", m.get("TWO"));
assertEquals("THREE", m.get("Three"));
assertTrue(getResultSet().next());
m = processor.toMap(getResultSet());
- assertEquals(COLS, m.size());
+ assertEquals(COLUMN_COUNT, m.size());
assertEquals("4", m.get("One")); // case shouldn't matter
assertEquals("5", m.get("two"));
diff --git a/src/test/java/org/apache/commons/dbutils/BeanProcessorTest.java b/src/test/java/org/apache/commons/dbutils/BeanProcessorTest.java
index 819ef85..a0a968c 100644
--- a/src/test/java/org/apache/commons/dbutils/BeanProcessorTest.java
+++ b/src/test/java/org/apache/commons/dbutils/BeanProcessorTest.java
@@ -202,7 +202,7 @@ public class BeanProcessorTest extends BaseTestCase {
final String testField = "first";
final Object[][] rows = { new Object[] { testField } };
- final ResultSet rs = MockResultSet.create(metaData, rows);
+ final ResultSet rs = MockResultSet.create(metaData, rows, false);
assertTrue(rs.next());
TestNoGetter testCls = new TestNoGetter();
testCls = beanProc.populateBean(rs, testCls);
@@ -226,7 +226,7 @@ public class BeanProcessorTest extends BaseTestCase {
final List<String> stuff = things;
final Object[][] rows = { new Object[] { name, things, stuff } };
- final ResultSet rs = MockResultSet.create(metaData, rows);
+ final ResultSet rs = MockResultSet.create(metaData, rows, false);
assertTrue(rs.next());
IndexedPropertyTestClass testCls = new IndexedPropertyTestClass();
testCls = beanProc.populateBean(rs, testCls);
@@ -318,7 +318,7 @@ public class BeanProcessorTest extends BaseTestCase {
final Integer testField = 1;
final Object[][] rows = { new Object[] { testField } };
- final ResultSet rs = MockResultSet.create(metaData, rows);
+ final ResultSet rs = MockResultSet.create(metaData, rows, false);
assertTrue(rs.next());
TestWrongSetter testCls = new TestWrongSetter();
testCls = beanProc.populateBean(rs, testCls);
diff --git a/src/test/java/org/apache/commons/dbutils/MockResultSet.java b/src/test/java/org/apache/commons/dbutils/MockResultSet.java
index 1f8026e..0831fc2 100644
--- a/src/test/java/org/apache/commons/dbutils/MockResultSet.java
+++ b/src/test/java/org/apache/commons/dbutils/MockResultSet.java
@@ -24,10 +24,11 @@ import java.sql.SQLException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
-import java.util.List;
import java.util.Objects;
import java.util.Set;
+import org.apache.commons.jxpath.util.TypeUtils;
+
/**
* MockResultSet dynamically implements the ResultSet interface.
*/
@@ -42,34 +43,38 @@ public class MockResultSet implements InvocationHandler {
* ProxyFactory.instance().createResultSet(new MockResultSet(metaData, rows));
* </pre>
*
- * @param metaData
+ * @param metaData Result set metadata.
* @param rows A null value indicates an empty {@code ResultSet}.
+ * @param unsupportedToDefault Whether to throw an exception or return null when an operation is unsupported.
*/
- public static ResultSet create(final ResultSetMetaData metaData, final Object[][] rows) {
- return ProxyFactory.instance().createResultSet(new MockResultSet(metaData, rows));
+ public static ResultSet create(final ResultSetMetaData metaData, final Object[][] rows, final boolean unsupportedToDefault) {
+ return ProxyFactory.instance().createResultSet(new MockResultSet(metaData, rows, unsupportedToDefault));
}
private Object[] currentRow;
- private Iterator<Object[]> iter;
+ private Iterator<Object[]> iterator;
private final ResultSetMetaData metaData;
private Boolean wasNull = Boolean.FALSE;
+ private final boolean unsupportedToDefault;
+
/**
* MockResultSet constructor.
*
- * @param metaData
+ * @param metaData Result set metadata.
* @param rows A null value indicates an empty {@code ResultSet}.
+ * @param unsupportedToDefault Whether to throw an exception or return null when an operation is unsupported.
*/
- public MockResultSet(final ResultSetMetaData metaData, final Object[][] rows) {
+ public MockResultSet(final ResultSetMetaData metaData, final Object[][] rows, final boolean unsupportedToDefault) {
this.metaData = metaData;
+ this.unsupportedToDefault = unsupportedToDefault;
if (rows == null) {
- final List<Object[]> empty = Collections.emptyList();
- this.iter = empty.iterator();
+ this.iterator = Collections.<Object[]>emptyList().iterator();
} else {
- this.iter = Arrays.asList(rows).iterator();
+ this.iterator = Arrays.asList(rows).iterator();
}
}
@@ -82,14 +87,11 @@ public class MockResultSet implements InvocationHandler {
* @throws SQLException if a database access error occurs
*/
private int columnIndex(final Object[] args) throws SQLException {
-
if (args[0] instanceof Integer) {
return ((Integer) args[0]).intValue();
-
}
if (args[0] instanceof String) {
return columnNameToIndex((String) args[0]);
-
}
throw new SQLException(args[0] + " must be Integer or String");
}
@@ -101,13 +103,15 @@ public class MockResultSet implements InvocationHandler {
* @throws SQLException if the column name is invalid
*/
private int columnNameToIndex(final String columnName) throws SQLException {
+ if (currentRow == null) {
+ throw new SQLException("No current row.");
+ }
for (int i = 0; i < this.currentRow.length; i++) {
final int c = i + 1;
if (this.metaData.getColumnName(c).equalsIgnoreCase(columnName)) {
return c;
}
}
-
throw new SQLException(columnName + " is not a valid column name.");
}
@@ -118,12 +122,10 @@ public class MockResultSet implements InvocationHandler {
* @throws SQLException if a database access error occurs
*/
protected Object getBoolean(final int columnIndex) throws SQLException {
- final Object obj = this.currentRow[columnIndex - 1];
+ final Object obj = getValueAt(columnIndex);
setWasNull(obj);
-
try {
return obj == null ? Boolean.FALSE : Boolean.valueOf(obj.toString());
-
} catch (final NumberFormatException e) {
throw new SQLException(e.getMessage());
}
@@ -136,12 +138,10 @@ public class MockResultSet implements InvocationHandler {
* @throws SQLException if a database access error occurs
*/
protected Object getByte(final int columnIndex) throws SQLException {
- final Object obj = this.currentRow[columnIndex - 1];
+ final Object obj = getValueAt(columnIndex);
setWasNull(obj);
-
try {
return obj == null ? Byte.valueOf((byte) 0) : Byte.valueOf(obj.toString());
-
} catch (final NumberFormatException e) {
throw new SQLException(e.getMessage());
}
@@ -154,12 +154,10 @@ public class MockResultSet implements InvocationHandler {
* @throws SQLException if a database access error occurs
*/
protected Object getDouble(final int columnIndex) throws SQLException {
- final Object obj = this.currentRow[columnIndex - 1];
+ final Object obj = getValueAt(columnIndex);
setWasNull(obj);
-
try {
return obj == null ? Double.valueOf(0) : Double.valueOf(obj.toString());
-
} catch (final NumberFormatException e) {
throw new SQLException(e.getMessage());
}
@@ -172,12 +170,10 @@ public class MockResultSet implements InvocationHandler {
* @throws SQLException if a database access error occurs
*/
protected Object getFloat(final int columnIndex) throws SQLException {
- final Object obj = this.currentRow[columnIndex - 1];
+ final Object obj = getValueAt(columnIndex);
setWasNull(obj);
-
try {
return obj == null ? Float.valueOf(0) : Float.valueOf(obj.toString());
-
} catch (final NumberFormatException e) {
throw new SQLException(e.getMessage());
}
@@ -190,12 +186,10 @@ public class MockResultSet implements InvocationHandler {
* @throws SQLException if a database access error occurs
*/
protected Object getInt(final int columnIndex) throws SQLException {
- final Object obj = this.currentRow[columnIndex - 1];
+ final Object obj = getValueAt(columnIndex);
setWasNull(obj);
-
try {
return obj == null ? Integer.valueOf(0) : Integer.valueOf(obj.toString());
-
} catch (final NumberFormatException e) {
throw new SQLException(e.getMessage());
}
@@ -208,12 +202,10 @@ public class MockResultSet implements InvocationHandler {
* @throws SQLException if a database access error occurs
*/
protected Object getLong(final int columnIndex) throws SQLException {
- final Object obj = this.currentRow[columnIndex - 1];
+ final Object obj = getValueAt(columnIndex);
setWasNull(obj);
-
try {
return obj == null ? Long.valueOf(0) : Long.valueOf(obj.toString());
-
} catch (final NumberFormatException e) {
throw new SQLException(e.getMessage());
}
@@ -233,7 +225,7 @@ public class MockResultSet implements InvocationHandler {
* @throws SQLException if a database access error occurs
*/
protected Object getObject(final int columnIndex) throws SQLException {
- final Object obj = this.currentRow[columnIndex - 1];
+ final Object obj = getValueAt(columnIndex);
setWasNull(obj);
return obj;
}
@@ -245,12 +237,10 @@ public class MockResultSet implements InvocationHandler {
* @throws SQLException if a database access error occurs
*/
protected Object getShort(final int columnIndex) throws SQLException {
- final Object obj = this.currentRow[columnIndex - 1];
+ final Object obj = getValueAt(columnIndex);
setWasNull(obj);
-
try {
return obj == null ? Short.valueOf((short) 0) : Short.valueOf(obj.toString());
-
} catch (final NumberFormatException e) {
throw new SQLException(e.getMessage());
}
@@ -268,34 +258,43 @@ public class MockResultSet implements InvocationHandler {
return Objects.toString(obj, null);
}
- private Object handleColumnMethod(final String methodName, final Object[] args) throws SQLException {
+ private Object getValueAt(final int columnIndex) {
+ return currentRow != null ? currentRow[columnIndex - 1] : null;
+ }
+
+ private Object handleColumnMethod(final Method method, final Object[] args) throws SQLException {
+ final String methodName = method.getName();
switch (methodName) {
- case "getBoolean":
- return getBoolean(columnIndex(args));
- case "getByte":
- return getByte(columnIndex(args));
- case "getDouble":
- return getDouble(columnIndex(args));
- case "getFloat":
- return getFloat(columnIndex(args));
- case "getInt":
- return getInt(columnIndex(args));
- case "getLong":
- return getLong(columnIndex(args));
- case "getObject":
- return getObject(columnIndex(args));
- case "getShort":
- return getShort(columnIndex(args));
- case "getString":
- return getString(columnIndex(args));
- case "wasNull":
- return wasNull();
- default:
- throw new UnsupportedOperationException("Unsupported column method: " + methodName);
+ case "getBoolean":
+ return getBoolean(columnIndex(args));
+ case "getByte":
+ return getByte(columnIndex(args));
+ case "getDouble":
+ return getDouble(columnIndex(args));
+ case "getFloat":
+ return getFloat(columnIndex(args));
+ case "getInt":
+ return getInt(columnIndex(args));
+ case "getLong":
+ return getLong(columnIndex(args));
+ case "getObject":
+ return getObject(columnIndex(args));
+ case "getShort":
+ return getShort(columnIndex(args));
+ case "getString":
+ return getString(columnIndex(args));
+ case "wasNull":
+ return wasNull();
+ default:
+ if (unsupportedToDefault) {
+ return unsupportedToDefault(method);
+ }
+ throw new UnsupportedOperationException("Unsupported column method: " + methodName);
}
}
- private Object handleNonColumnMethod(final String methodName, final Object proxy, final Object[] args) throws SQLException {
+ private Object handleNonColumnMethod(final Method method, final Object proxy, final Object[] args) throws SQLException {
+ final String methodName = method.getName();
switch (methodName) {
case "isLast":
return isLast();
@@ -306,14 +305,15 @@ public class MockResultSet implements InvocationHandler {
case "equals":
return Boolean.valueOf(proxy == args[0]);
default:
+ if (unsupportedToDefault) {
+ return unsupportedToDefault(method);
+ }
throw new UnsupportedOperationException("Unsupported non-column method: " + methodName);
}
}
@Override
- public Object invoke(final Object proxy, final Method method, final Object[] args)
- throws Throwable {
-
+ public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
final String methodName = method.getName();
switch (methodName) {
case "getMetaData":
@@ -326,15 +326,27 @@ public class MockResultSet implements InvocationHandler {
break;
default:
if (isColumnMethod(methodName)) {
- return handleColumnMethod(methodName, args);
- } else if (METHOD_NAMES.contains(methodName)) {
- return handleNonColumnMethod(methodName, proxy, args);
+ return handleColumnMethod(method, args);
+ }
+ if (METHOD_NAMES.contains(methodName)) {
+ return handleNonColumnMethod(method, proxy, args);
}
break;
}
+ if (unsupportedToDefault) {
+ return unsupportedToDefault(method);
+ }
throw new UnsupportedOperationException("Unsupported method: " + methodName);
}
+ private Object unsupportedToDefault(final Method method) {
+ final Class<?> returnType = method.getReturnType();
+ if (returnType.isPrimitive()) {
+ return TypeUtils.convert(null, returnType);
+ }
+ return null;
+ }
+
private boolean isColumnMethod(final String methodName) {
return methodName.startsWith("get") || methodName.equals("wasNull");
}
@@ -343,17 +355,21 @@ public class MockResultSet implements InvocationHandler {
* @throws SQLException
*/
protected Boolean isLast() throws SQLException {
- return this.iter.hasNext() ? Boolean.FALSE : Boolean.TRUE;
+ return hasNext() ? Boolean.FALSE : Boolean.TRUE;
+ }
+
+ private boolean hasNext() {
+ return iterator.hasNext();
}
/**
* @throws SQLException
*/
protected Boolean next() throws SQLException {
- if (!this.iter.hasNext()) {
+ if (!hasNext()) {
return Boolean.FALSE;
}
- this.currentRow = iter.next();
+ this.currentRow = iterator.next();
return Boolean.TRUE;
}
diff --git a/src/test/java/org/apache/commons/dbutils/ResultSetIteratorTest.java b/src/test/java/org/apache/commons/dbutils/ResultSetIteratorTest.java
index d2de5de..bafea31 100644
--- a/src/test/java/org/apache/commons/dbutils/ResultSetIteratorTest.java
+++ b/src/test/java/org/apache/commons/dbutils/ResultSetIteratorTest.java
@@ -49,14 +49,14 @@ public class ResultSetIteratorTest extends BaseTestCase {
assertTrue(iter.hasNext());
Object[] row = iter.next();
- assertEquals(COLS, row.length);
+ assertEquals(COLUMN_COUNT, row.length);
assertEquals("1", row[0]);
assertEquals("2", row[1]);
assertEquals("THREE", row[2]);
assertTrue(iter.hasNext());
row = iter.next();
- assertEquals(COLS, row.length);
+ assertEquals(COLUMN_COUNT, row.length);
assertEquals("4", row[0]);
assertEquals("5", row[1]);
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/ArrayHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/ArrayHandlerTest.java
index 108230f..8d865b5 100644
--- a/src/test/java/org/apache/commons/dbutils/handlers/ArrayHandlerTest.java
+++ b/src/test/java/org/apache/commons/dbutils/handlers/ArrayHandlerTest.java
@@ -44,7 +44,7 @@ public class ArrayHandlerTest extends BaseTestCase {
final Object[] results = h.handle(getResultSet());
assertNotNull(results);
- assertEquals(COLS, results.length);
+ assertEquals(COLUMN_COUNT, results.length);
assertEquals("1", results[0]);
assertEquals("2", results[1]);
assertEquals("THREE", results[2]);
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/ArrayListHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/ArrayListHandlerTest.java
index 75efdd5..3f54b3a 100644
--- a/src/test/java/org/apache/commons/dbutils/handlers/ArrayListHandlerTest.java
+++ b/src/test/java/org/apache/commons/dbutils/handlers/ArrayListHandlerTest.java
@@ -49,19 +49,19 @@ public class ArrayListHandlerTest extends BaseTestCase {
final List<Object[]> results = h.handle(getResultSet());
assertNotNull(results);
- assertEquals(ROWS, results.size());
+ assertEquals(ROW_COUNT, results.size());
final Iterator<Object[]> iter = results.iterator();
assertTrue(iter.hasNext());
Object[] row = iter.next();
- assertEquals(COLS, row.length);
+ assertEquals(COLUMN_COUNT, row.length);
assertEquals("1", row[0]);
assertEquals("2", row[1]);
assertEquals("THREE", row[2]);
assertTrue(iter.hasNext());
row = iter.next();
- assertEquals(COLS, row.length);
+ assertEquals(COLUMN_COUNT, row.length);
assertEquals("4", row[0]);
assertEquals("5", row[1]);
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/BeanListHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/BeanListHandlerTest.java
index 85cb0b7..ad63fee 100644
--- a/src/test/java/org/apache/commons/dbutils/handlers/BeanListHandlerTest.java
+++ b/src/test/java/org/apache/commons/dbutils/handlers/BeanListHandlerTest.java
@@ -64,7 +64,7 @@ public class BeanListHandlerTest extends BaseTestCase {
final List<TestBean> results = h.handle(getResultSet());
assertNotNull(results);
- assertEquals(ROWS, results.size());
+ assertEquals(ROW_COUNT, results.size());
final Iterator<TestBean> iter = results.iterator();
TestBean row;
@@ -92,7 +92,7 @@ public class BeanListHandlerTest extends BaseTestCase {
final List<SubTestBeanInterface> results = h.handle(getResultSet());
assertNotNull(results);
- assertEquals(ROWS, results.size());
+ assertEquals(ROW_COUNT, results.size());
final Iterator<SubTestBeanInterface> iter = results.iterator();
SubTestBeanInterface row;
@@ -123,7 +123,7 @@ public class BeanListHandlerTest extends BaseTestCase {
final List<TestBean> results = h.handle(getResultSet());
assertNotNull(results);
- assertEquals(ROWS, results.size());
+ assertEquals(ROW_COUNT, results.size());
final Iterator<TestBean> iter = results.iterator();
assertTrue(iter.hasNext());
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/ColumnListHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/ColumnListHandlerTest.java
index b0a4b39..6edab2c 100644
--- a/src/test/java/org/apache/commons/dbutils/handlers/ColumnListHandlerTest.java
+++ b/src/test/java/org/apache/commons/dbutils/handlers/ColumnListHandlerTest.java
@@ -38,7 +38,7 @@ public class ColumnListHandlerTest extends BaseTestCase {
final List<String> results = h.handle(getResultSet());
assertNotNull(results);
- assertEquals(ROWS, results.size());
+ assertEquals(ROW_COUNT, results.size());
assertEquals("2", results.get(0));
assertEquals("5", results.get(1));
@@ -50,7 +50,7 @@ public class ColumnListHandlerTest extends BaseTestCase {
final List<Integer> results = h.handle(getResultSet());
assertNotNull(results);
- assertEquals(ROWS, results.size());
+ assertEquals(ROW_COUNT, results.size());
assertEquals(Integer.valueOf(1), results.get(0));
assertEquals(Integer.valueOf(3), results.get(1));
@@ -71,7 +71,7 @@ public class ColumnListHandlerTest extends BaseTestCase {
final List<String> results = h.handle(getResultSet());
assertNotNull(results);
- assertEquals(ROWS, results.size());
+ assertEquals(ROW_COUNT, results.size());
assertEquals("1", results.get(0));
assertEquals("4", results.get(1));
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/KeyedHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/KeyedHandlerTest.java
index d179fbe..fa48c1e 100644
--- a/src/test/java/org/apache/commons/dbutils/handlers/KeyedHandlerTest.java
+++ b/src/test/java/org/apache/commons/dbutils/handlers/KeyedHandlerTest.java
@@ -38,7 +38,7 @@ public class KeyedHandlerTest extends BaseTestCase {
final Map<String, Map<String, Object>> results = h.handle(getResultSet());
assertNotNull(results);
- assertEquals(ROWS, results.size());
+ assertEquals(ROW_COUNT, results.size());
Map<String, Object> row = null;
for (final Entry<String, Map<String, Object>> entry : results.entrySet()) {
@@ -46,7 +46,7 @@ public class KeyedHandlerTest extends BaseTestCase {
assertNotNull(key);
row = entry.getValue();
assertNotNull(row);
- assertEquals(COLS, row.size());
+ assertEquals(COLUMN_COUNT, row.size());
}
row = results.get("5");
assertEquals("4", row.get("one"));
@@ -60,7 +60,7 @@ public class KeyedHandlerTest extends BaseTestCase {
final Map<Integer, Map<String, Object>> results = h.handle(getResultSet());
assertNotNull(results);
- assertEquals(ROWS, results.size());
+ assertEquals(ROW_COUNT, results.size());
Map<String, Object> row = null;
for (final Entry<Integer, Map<String, Object>> entry : results.entrySet()) {
@@ -68,7 +68,7 @@ public class KeyedHandlerTest extends BaseTestCase {
assertNotNull(key);
row = entry.getValue();
assertNotNull(row);
- assertEquals(COLS, row.size());
+ assertEquals(COLUMN_COUNT, row.size());
}
row = results.get(Integer.valueOf(3));
assertEquals("4", row.get("one"));
@@ -91,7 +91,7 @@ public class KeyedHandlerTest extends BaseTestCase {
final Map<String, Map<String, Object>> results = h.handle(getResultSet());
assertNotNull(results);
- assertEquals(ROWS, results.size());
+ assertEquals(ROW_COUNT, results.size());
Map<String, Object> row = null;
for (final Entry<String, Map<String, Object>> entry : results.entrySet()) {
@@ -99,7 +99,7 @@ public class KeyedHandlerTest extends BaseTestCase {
assertNotNull(key);
row = entry.getValue();
assertNotNull(row);
- assertEquals(COLS, row.size());
+ assertEquals(COLUMN_COUNT, row.size());
}
row = results.get("1");
assertEquals("1", row.get("one"));
@@ -114,7 +114,7 @@ public class KeyedHandlerTest extends BaseTestCase {
final Map<String, Map<String, Object>> results = h.handle(getResultSet());
assertNotNull(results);
- assertEquals(ROWS, results.size());
+ assertEquals(ROW_COUNT, results.size());
Map<String, Object> row = null;
for (final Entry<String, Map<String, Object>> entry : results.entrySet()) {
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/MapHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/MapHandlerTest.java
index 74a9ecd..bd28606 100644
--- a/src/test/java/org/apache/commons/dbutils/handlers/MapHandlerTest.java
+++ b/src/test/java/org/apache/commons/dbutils/handlers/MapHandlerTest.java
@@ -46,7 +46,7 @@ public class MapHandlerTest extends BaseTestCase {
final Map<String, Object> results = h.handle(getResultSet());
assertNotNull(results);
- assertEquals(COLS, results.size());
+ assertEquals(COLUMN_COUNT, results.size());
assertEquals("1", results.get("ONE"));
assertEquals("2", results.get("two"));
assertEquals("THREE", results.get("Three"));
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/MapListHandlerTest.java b/src/test/java/org/apache/commons/dbutils/handlers/MapListHandlerTest.java
index 1a6050a..9784581 100644
--- a/src/test/java/org/apache/commons/dbutils/handlers/MapListHandlerTest.java
+++ b/src/test/java/org/apache/commons/dbutils/handlers/MapListHandlerTest.java
@@ -50,19 +50,19 @@ public class MapListHandlerTest extends BaseTestCase {
final List<Map<String, Object>> results = h.handle(getResultSet());
assertNotNull(results);
- assertEquals(ROWS, results.size());
+ assertEquals(ROW_COUNT, results.size());
final Iterator<Map<String, Object>> iter = results.iterator();
assertTrue(iter.hasNext());
Map<String, Object> row = iter.next();
- assertEquals(COLS, row.size());
+ assertEquals(COLUMN_COUNT, row.size());
assertEquals("1", row.get("one"));
assertEquals("2", row.get("TWO"));
assertEquals("THREE", row.get("Three"));
assertTrue(iter.hasNext());
row = iter.next();
- assertEquals(COLS, row.size());
+ assertEquals(COLUMN_COUNT, row.size());
assertEquals("4", row.get("one"));
assertEquals("5", row.get("TWO"));
diff --git a/src/test/java/org/apache/commons/dbutils/wrappers/StringTrimmedResultSetTest.java b/src/test/java/org/apache/commons/dbutils/wrappers/StringTrimmedResultSetTest.java
index 8ba740c..f01d986 100644
--- a/src/test/java/org/apache/commons/dbutils/wrappers/StringTrimmedResultSetTest.java
+++ b/src/test/java/org/apache/commons/dbutils/wrappers/StringTrimmedResultSetTest.java
@@ -59,7 +59,7 @@ public class StringTrimmedResultSetTest extends BaseTestCase {
public void testMultipleWrappers() throws Exception {
// Create a ResultSet with data
final Object[][] rows = { { null } };
- ResultSet rs = MockResultSet.create(metaData, rows);
+ ResultSet rs = MockResultSet.create(META_DATA, rows, false);
// Wrap the ResultSet with a null checked version
final SqlNullCheckedResultSet ncrs = new SqlNullCheckedResultSet(rs);