private abstract static class ClosedObjectTest.ObjectDecorator
extends junit.extensions.TestSetup
Modifier and Type | Field and Description |
---|---|
private ClosedObjectTest.DataSourceDecorator |
decorator_
Decorator which provides a connection.
|
protected java.lang.Object |
object_
The closed object.
|
Constructor and Description |
---|
ObjectDecorator(junit.framework.Test test,
ClosedObjectTest.DataSourceDecorator decorator)
Creates a new
ObjectDecorator instance. |
Modifier and Type | Method and Description |
---|---|
void |
checkException(java.lang.reflect.Method method,
java.sql.SQLException sqle)
Checks whether an exception is of the expected type for
that method.
|
protected abstract void |
checkSQLState(java.lang.reflect.Method method,
java.sql.SQLException sqle)
Checks whether the SQL state is as expected.
|
protected java.sql.Connection |
createConnection()
Helper method for creating a connection.
|
protected java.sql.Statement |
createStatement()
Helper method for creating a statement.
|
boolean |
expectsException(java.lang.reflect.Method method)
Checks whether a method expects an exception to be thrown
when the object is closed.
|
java.lang.Object |
getClosedObject()
Returns the closed object.
|
protected java.sql.CallableStatement |
prepareCall(java.lang.String call)
Helper method for creating a callable statement.
|
protected java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
Helper method for creating a prepared statement.
|
protected void |
tearDown()
Tears down the test environment.
|
basicRun, countTestCases, getTest, toString
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
private final ClosedObjectTest.DataSourceDecorator decorator_
protected java.lang.Object object_
public ObjectDecorator(junit.framework.Test test, ClosedObjectTest.DataSourceDecorator decorator)
ObjectDecorator
instance.test
- a test or suite to decoratedecorator
- a decorator which provides a connectionprotected void tearDown() throws java.lang.Exception
tearDown
in class junit.extensions.TestSetup
java.lang.Exception
public java.lang.Object getClosedObject()
public boolean expectsException(java.lang.reflect.Method method)
close()
, isClosed()
, isValid()
and
abort()
don't expect exceptions.method
- a methodtrue
if an exception is expectedpublic final void checkException(java.lang.reflect.Method method, java.sql.SQLException sqle) throws java.sql.SQLException
method
- a methodsqle
- an exceptionjava.sql.SQLException
- if the exception was not expectedprotected abstract void checkSQLState(java.lang.reflect.Method method, java.sql.SQLException sqle) throws java.sql.SQLException
method
- a Method
valuesqle
- a SQLException
valuejava.sql.SQLException
- if an error occursprotected java.sql.Connection createConnection() throws java.sql.SQLException
java.sql.SQLException
- if an error occursprotected java.sql.Statement createStatement() throws java.sql.SQLException
java.sql.SQLException
- if an error occursprotected java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException
sql
- statement textjava.sql.SQLException
- if an error occursprotected java.sql.CallableStatement prepareCall(java.lang.String call) throws java.sql.SQLException
call
- statement textjava.sql.SQLException
- if an error occursApache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.