Author: dfabulich
Date: Wed Mar 11 00:56:31 2009
New Revision: 752329
URL: http://svn.apache.org/viewvc?rev=752329&view=rev
Log: (empty)
Modified:
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
Modified:
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java?rev=752329&r1=752328&r2=752329&view=diff
==============================================================================
---
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
(original)
+++
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
Wed Mar 11 00:56:31 2009
@@ -59,7 +59,7 @@
runner.fillStatement(stmt, new Object[] { null, null });
}
- private PreparedStatement fakeFillablePreparedStatement(final boolean
simulateOracle, final int[] types) {
+ private PreparedStatement fakeFillablePreparedStatement(final boolean
simulateOracle, final int[] types) throws NoSuchMethodException {
// prepare a mock ParameterMetaData and a mock PreparedStatement to
return the PMD
final ParameterMetaData pmd =
mockParameterMetaData(simulateOracle,types);
InvocationHandler stmtHandler = new InvocationHandler() {
@@ -153,8 +153,7 @@
public void testFillStatementWithBeanErrorReadMethodPrivate() throws
Exception {
getPrivate();
- Method getPrivate = getClass().getDeclaredMethod("getPrivate", new
Class[0]);
- PropertyDescriptor badReadMethod = new
PropertyDescriptor("throwsException", getPrivate, null);
+ PropertyDescriptor badReadMethod = new BadPrivatePropertyDescriptor();
PropertyDescriptor properties[] = new PropertyDescriptor[] {
badReadMethod };
try {
runner.fillStatementWithBean(stmt, this, properties);
@@ -162,6 +161,19 @@
} catch (RuntimeException expected) {}
}
+ class BadPrivatePropertyDescriptor extends PropertyDescriptor {
+ Method getPrivate;
+ BadPrivatePropertyDescriptor() throws Exception {
+ super("throwsException", QueryRunnerTest.class,
"getThrowsException", null);
+ getPrivate = QueryRunnerTest.class.getDeclaredMethod("getPrivate",
new Class[0]);
+ }
+
+ public synchronized Method getReadMethod() {
+ if (getPrivate == null) return super.getReadMethod();
+ return getPrivate;
+ }
+ }
+
public void testRethrowNullMessage() {
// DBUTILS-40
SQLException sqe = new SQLException((String)null);