All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mockrunner.test.jdbc.BasicJDBCTestCaseAdapterTest Maven / Gradle / Ivy

Go to download

Mockrunner is a lightweight framework for unit testing applications in the J2EE environment. It supports servlets, filters, tag classes and Struts actions. It includes a JDBC a JMS and a JCA test framework and can be used to test EJB based applications.

The newest version!
package com.mockrunner.test.jdbc;

import java.sql.DriverManager;
import java.util.Enumeration;

import com.mockrunner.jdbc.BasicJDBCTestCaseAdapter;
import com.mockrunner.mock.jdbc.JDBCMockObjectFactory;
import com.mockrunner.mock.jdbc.MockDriver;

public class BasicJDBCTestCaseAdapterTest extends BasicJDBCTestCaseAdapter
{
    private JDBCMockObjectFactory factory;
    
    protected void setUp() throws Exception
    {
        factory = new  JDBCMockObjectFactory();
        setJDBCMockObjectFactory(factory);
        super.setUp();
    }
    
    public void testJDBCFactorySet()
    {
        assertSame(factory, getJDBCMockObjectFactory());
        assertSame(getJDBCMockObjectFactory(), getJDBCMockObjectFactory());
    }
    
    public void testDriverDeregistered() throws Exception
    {
        Enumeration drivers = DriverManager.getDrivers();
        assertTrue(drivers.nextElement() instanceof MockDriver);
        assertFalse(drivers.hasMoreElements());
        super.tearDown();
        drivers = DriverManager.getDrivers();
        while(drivers.hasMoreElements())
        {
            assertFalse(drivers.nextElement() instanceof MockDriver);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy