com.mockrunner.test.connector.ConnectorMockObjectFactoryTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockrunner-jdk1.3-j2ee1.3 Show documentation
Show all versions of mockrunner-jdk1.3-j2ee1.3 Show documentation
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() {};
}
}
}