完善mock和测试

git-svn-id: http://code.alibabatech.com/svn/druid/trunk@787 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
wenshao
2011-09-16 03:10:05 +00:00
parent 8549dd0754
commit 15096dcc8c
2 changed files with 137 additions and 9 deletions
@@ -1,5 +1,6 @@
package com.alibaba.druid.bvt.pool.basic;
import java.sql.ResultSet;
import java.sql.SQLException;
import junit.framework.TestCase;
@@ -132,6 +133,31 @@ public class ResultSetTest2 extends TestCase {
Assert.assertNotNull(error);
}
}
public void test_FetchDirection() throws Exception {
resultSet.setFetchDirection(ResultSet.FETCH_REVERSE);
Assert.assertEquals(ResultSet.FETCH_REVERSE, resultSet.getFetchDirection());
raw.close();
{
SQLException error = null;
try {
resultSet.getFetchDirection();
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
resultSet.setFetchDirection(ResultSet.FETCH_REVERSE);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
}
public void test_getHoldability() throws Exception {
resultSet.getHoldability();
@@ -228,6 +254,102 @@ public class ResultSetTest2 extends TestCase {
Assert.assertNotNull(error);
}
}
public void test_deleteRow() throws Exception {
resultSet.deleteRow();
raw.close();
{
SQLException error = null;
try {
resultSet.deleteRow();
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
}
public void test_updateRow() throws Exception {
resultSet.deleteRow();
raw.close();
{
SQLException error = null;
try {
resultSet.updateRow();
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
}
public void test_insertRow() throws Exception {
resultSet.deleteRow();
raw.close();
{
SQLException error = null;
try {
resultSet.insertRow();
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
}
public void test_previous() throws Exception {
resultSet.previous();
raw.close();
{
SQLException error = null;
try {
resultSet.previous();
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
}
public void test_relative() throws Exception {
resultSet.relative(1);
raw.close();
{
SQLException error = null;
try {
resultSet.relative(1);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
}
public void test_absolute() throws Exception {
resultSet.absolute(1);
raw.close();
{
SQLException error = null;
try {
resultSet.absolute(1);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
}
}