git-svn-id: http://code.alibabatech.com/svn/druid/trunk@745 b9813039-fb51-4c41-a8b9-e21c2acb5095

This commit is contained in:
wenshao
2011-09-15 05:00:21 +00:00
parent 8deef3cb28
commit 9eaf49542d
@@ -10,26 +10,27 @@ import com.alibaba.druid.mock.MockResultSet;
import com.alibaba.druid.pool.PoolableResultSet;
import com.alibaba.druid.pool.PoolableStatement;
public class PoolableResultSetTest extends TestCase {
public void test_0() throws Exception {
PoolableStatement stmt = new PoolableStatement(null, null) {
protected SQLException checkException(Throwable error) throws SQLException {
if (error instanceof SQLException) {
return (SQLException) error;
}
return new SQLException(error);
}
};
MockResultSet raw = new MockResultSet(null);
raw.getRows().add(new Object[] {null});
raw.getRows().add(new Object[] { null });
PoolableResultSet resultSet = new PoolableResultSet(stmt, raw);
Assert.assertTrue(stmt == resultSet.getPoolableStatement());
Assert.assertTrue(raw == resultSet.getRawResultSet());
Assert.assertTrue(resultSet.next());
Assert.assertTrue(resultSet.wasNull() == false);
resultSet.getString(1);
@@ -50,7 +51,7 @@ public class PoolableResultSetTest extends TestCase {
resultSet.getAsciiStream(1);
resultSet.getUnicodeStream(1);
resultSet.getBinaryStream(1);
resultSet.getString("1");
resultSet.getBoolean("1");
resultSet.getByte("1");
@@ -68,5 +69,176 @@ public class PoolableResultSetTest extends TestCase {
resultSet.getAsciiStream("1");
resultSet.getUnicodeStream("1");
resultSet.getBinaryStream("1");
{
SQLException error = null;
try {
resultSet.getString(0);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
resultSet.getBoolean(0);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
resultSet.getByte(0);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
resultSet.getShort(0);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
resultSet.getInt(0);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
resultSet.getLong(0);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
resultSet.getFloat(0);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
resultSet.getDouble(0);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
resultSet.getBigDecimal(0);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
resultSet.getBigDecimal(0, 1);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
resultSet.getBytes(0);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
resultSet.getDate(0);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
resultSet.getTime(0);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
resultSet.getTimestamp(0);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
resultSet.getAsciiStream(0);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
resultSet.getUnicodeStream(0);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
resultSet.getBinaryStream(0);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
}
}