01: package com.mockrunner.test.jdbc;
02:
03: import java.sql.DriverManager;
04: import java.util.Enumeration;
05:
06: import com.mockrunner.jdbc.BasicJDBCTestCaseAdapter;
07: import com.mockrunner.mock.jdbc.JDBCMockObjectFactory;
08: import com.mockrunner.mock.jdbc.MockDriver;
09:
10: public class BasicJDBCTestCaseAdapterTest extends
11: BasicJDBCTestCaseAdapter {
12: private JDBCMockObjectFactory factory;
13:
14: protected void setUp() throws Exception {
15: factory = new JDBCMockObjectFactory();
16: setJDBCMockObjectFactory(factory);
17: super .setUp();
18: }
19:
20: public void testJDBCFactorySet() {
21: assertSame(factory, getJDBCMockObjectFactory());
22: assertSame(getJDBCMockObjectFactory(),
23: getJDBCMockObjectFactory());
24: }
25:
26: public void testDriverDeregistered() throws Exception {
27: Enumeration drivers = DriverManager.getDrivers();
28: assertTrue(drivers.nextElement() instanceof MockDriver);
29: assertFalse(drivers.hasMoreElements());
30: super .tearDown();
31: drivers = DriverManager.getDrivers();
32: while (drivers.hasMoreElements()) {
33: assertFalse(drivers.nextElement() instanceof MockDriver);
34: }
35: }
36: }
|