mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
完善mock和测试
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@777 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -741,80 +741,67 @@ public class MockResultSet implements ResultSet {
|
||||
|
||||
@Override
|
||||
public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException {
|
||||
|
||||
return null;
|
||||
return getObject(columnLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ref getRef(String columnLabel) throws SQLException {
|
||||
|
||||
return null;
|
||||
return (Ref) getObject(columnLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Blob getBlob(String columnLabel) throws SQLException {
|
||||
|
||||
return null;
|
||||
return (Blob) getObject(columnLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Clob getClob(String columnLabel) throws SQLException {
|
||||
|
||||
return null;
|
||||
return (Clob) getObject(columnLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Array getArray(String columnLabel) throws SQLException {
|
||||
|
||||
return null;
|
||||
return (Array) getObject(columnLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getDate(int columnIndex, Calendar cal) throws SQLException {
|
||||
|
||||
return null;
|
||||
return (Date) getObject(columnIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getDate(String columnLabel, Calendar cal) throws SQLException {
|
||||
|
||||
return null;
|
||||
return (Date) getObject(columnLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Time getTime(int columnIndex, Calendar cal) throws SQLException {
|
||||
|
||||
return null;
|
||||
return (Time) getObject(columnIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Time getTime(String columnLabel, Calendar cal) throws SQLException {
|
||||
|
||||
return null;
|
||||
return (Time) getObject(columnLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
|
||||
|
||||
return null;
|
||||
return (Timestamp) getObject(columnIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException {
|
||||
|
||||
return null;
|
||||
return (Timestamp) getObject(columnLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getURL(int columnIndex) throws SQLException {
|
||||
|
||||
return null;
|
||||
return (URL) getObject(columnIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getURL(String columnLabel) throws SQLException {
|
||||
|
||||
return null;
|
||||
return (URL) getObject(columnLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.io.Reader;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.SQLXML;
|
||||
import java.util.Collections;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
@@ -1412,4 +1413,246 @@ public class ResultSetTest extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void test_getURL() throws Exception {
|
||||
resultSet.next();
|
||||
|
||||
resultSet.getURL(1);
|
||||
resultSet.getURL("1");
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getURL("0");
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getURL("0");
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
}
|
||||
|
||||
public void test_getTimestamp() throws Exception {
|
||||
resultSet.next();
|
||||
|
||||
resultSet.getTimestamp(1, null);
|
||||
resultSet.getTimestamp("1", null);
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getTimestamp("0", null);
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getTimestamp("0", null);
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
}
|
||||
|
||||
public void test_getTime() throws Exception {
|
||||
resultSet.next();
|
||||
|
||||
resultSet.getTime(1, null);
|
||||
resultSet.getTime("1", null);
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getTime("0", null);
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getTime("0", null);
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
}
|
||||
|
||||
public void test_getDate() throws Exception {
|
||||
resultSet.next();
|
||||
|
||||
resultSet.getDate(1, null);
|
||||
resultSet.getDate("1", null);
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getDate("0", null);
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getDate("0", null);
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
}
|
||||
|
||||
public void test_getArray() throws Exception {
|
||||
resultSet.next();
|
||||
|
||||
resultSet.getArray(1);
|
||||
resultSet.getArray("1");
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getArray("0");
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getArray("0");
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
}
|
||||
|
||||
public void test_getClob() throws Exception {
|
||||
resultSet.next();
|
||||
|
||||
resultSet.getClob(1);
|
||||
resultSet.getClob("1");
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getClob("0");
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getClob("0");
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
}
|
||||
|
||||
public void test_getBlob() throws Exception {
|
||||
resultSet.next();
|
||||
|
||||
resultSet.getBlob(1);
|
||||
resultSet.getBlob("1");
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getBlob("0");
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getBlob("0");
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
}
|
||||
|
||||
public void test_getRef() throws Exception {
|
||||
resultSet.next();
|
||||
|
||||
resultSet.getRef(1);
|
||||
resultSet.getRef("1");
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getRef("0");
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getRef("0");
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
}
|
||||
|
||||
public void test_getObject() throws Exception {
|
||||
resultSet.next();
|
||||
|
||||
resultSet.getObject(1, null);
|
||||
resultSet.getObject("1", null);
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getObject("0", null);
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
|
||||
{
|
||||
SQLException error = null;
|
||||
try {
|
||||
resultSet.getObject("0", null);
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user