1 61 62 package org.apache.commons.dbutils; 63 64 import java.lang.reflect.InvocationHandler ; 65 import java.lang.reflect.Method ; 66 import java.sql.CallableStatement ; 67 import java.sql.Connection ; 68 import java.sql.Driver ; 69 import java.sql.PreparedStatement ; 70 import java.sql.ResultSet ; 71 import java.sql.ResultSetMetaData ; 72 import java.sql.Statement ; 73 74 80 public class ProxyFactoryTest extends BaseTestCase { 81 82 private static final InvocationHandler stub = new InvocationHandler () { 83 84 public Object invoke(Object proxy, Method method, Object [] args) 85 throws Throwable { 86 87 return null; 88 } 89 }; 90 91 94 public ProxyFactoryTest(String name) { 95 super(name); 96 } 97 98 public void testCreateConnection() { 99 assertTrue( 100 ProxyFactory.instance().createConnection(stub) 101 instanceof Connection ); 102 } 103 104 public void testCreateDriver() { 105 assertTrue( 106 ProxyFactory.instance().createDriver(stub) instanceof Driver ); 107 } 108 109 public void testCreatePreparedStatement() { 110 assertTrue( 111 ProxyFactory.instance().createPreparedStatement(stub) 112 instanceof PreparedStatement ); 113 } 114 115 public void testCreateResultSet() { 116 assertTrue( 117 ProxyFactory.instance().createResultSet(stub) instanceof ResultSet ); 118 } 119 120 public void testCreateResultSetMetaData() { 121 assertTrue( 122 ProxyFactory.instance().createResultSetMetaData(stub) 123 instanceof ResultSetMetaData ); 124 } 125 126 public void testCreateStatement() { 127 assertTrue( 128 ProxyFactory.instance().createStatement(stub) instanceof Statement ); 129 } 130 131 public void testCreateCallableStatement() { 132 assertTrue( 133 ProxyFactory.instance().createCallableStatement(stub) 134 instanceof CallableStatement ); 135 } 136 137 } 138 | Popular Tags |