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

com.mockrunner.test.connector.ConnectorMockObjectFactoryTest 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.connector;

import junit.framework.TestCase;

import com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory;
import com.mockrunner.mock.connector.cci.MockConnection;
import com.mockrunner.mock.connector.cci.MockConnectionFactory;

public class ConnectorMockObjectFactoryTest extends TestCase
{
    public void testSetup() throws Exception
    {
        ConnectorMockObjectFactory factory = new ConnectorMockObjectFactory();
        MockConnectionFactory connectionFactory = factory.getMockConnectionFactory();
        assertSame(connectionFactory.getConnection(), factory.getMockConnection());
        assertSame(connectionFactory.getMockConnection(), factory.getMockConnection());
        assertSame(factory.getInteractionHandler(), connectionFactory.getMockConnection().getInteractionHandler());
    }
    
    public void testOverrideCreate()
    {
        ConnectorMockObjectFactory factory = new TestConnectorMockObjectFactory();
        assertNotSame(factory.getMockConnection().getClass(), MockConnection.class);
        assertNotSame(factory.getMockConnectionFactory().getClass(), MockConnectionFactory.class);
    }
    
    public static class TestConnectorMockObjectFactory extends ConnectorMockObjectFactory
    {
        public MockConnection createMockConnection()
        {
            return new MockConnection() {};
        }

        public MockConnectionFactory createMockConnectionFactory()
        {
            return new MockConnectionFactory() {};
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy