|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.mockrunner.mock.jdbc.JDBCMockObjectFactory
public class JDBCMockObjectFactory
Used to create all types of JDBC mock objects.
Maintains the necessary dependencies between the mock objects.
If you use the mock objects returned by this
factory in your tests you can be sure that they are all
up to date.
Please note, that this class removes all drivers
from the JDBC DriverManager
and registers
the MockDriver
. All drivers are preserved and
can be restored with restoreDrivers()
.
Constructor Summary | |
---|---|
JDBCMockObjectFactory()
Creates a new set of mock objects. |
Method Summary | |
---|---|
MockConnection |
createMockConnection()
Creates the MockConnection using new . |
MockDataSource |
createMockDataSource()
Creates the MockDataSource using new . |
MockDriver |
createMockDriver()
Creates the MockDriver using new . |
MockConnection |
getMockConnection()
Returns the MockConnection . |
MockDataSource |
getMockDataSource()
Returns the MockDataSource . |
MockDriver |
getMockDriver()
Returns the MockDriver . |
void |
registerMockDriver()
Removes all JDBC drivers from the DriveManager and
registers the mock driver. |
void |
restoreDrivers()
Since JDBCMockObjectFactory removes all the
drivers from the DriveManager (so the
MockDriver is guaranteed to be the only one)
you can use this method to restore the original drivers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JDBCMockObjectFactory()
Method Detail |
---|
public void registerMockDriver()
DriveManager
and
registers the mock driver. The removed drivers are preserved and
can be restored with restoreDrivers()
.
public void restoreDrivers()
JDBCMockObjectFactory
removes all the
drivers from the DriveManager
(so the
MockDriver
is guaranteed to be the only one)
you can use this method to restore the original drivers.
Automatically called by BaseTestCase.tearDown()
.
public MockConnection createMockConnection()
MockConnection
using new
.
This method can be overridden to return a subclass of MockConnection
.
MockConnection
public MockDriver createMockDriver()
MockDriver
using new
.
This method can be overridden to return a subclass of MockDriver
.
MockDriver
public MockDataSource createMockDataSource()
MockDataSource
using new
.
This method can be overridden to return a subclass of MockDataSource
.
MockDataSource
public MockDataSource getMockDataSource()
MockDataSource
.
MockDataSource
public MockDriver getMockDriver()
MockDriver
.
MockDriver
public MockConnection getMockConnection()
MockConnection
.
MockConnection
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |