com.mockrunner.test.ejb.EJBTestCaseAdapterDelegateEnvJNDITest 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.ejb;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.mockejb.jndi.MockContextFactory;
import com.mockrunner.ejb.EJBTestCaseAdapter;
import com.mockrunner.test.ejb.TestJNDI.TestContextFactory;
public class EJBTestCaseAdapterDelegateEnvJNDITest extends EJBTestCaseAdapter
{
protected void setUp() throws Exception
{
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, TestContextFactory.class.getName());
MockContextFactory.setDelegateEnvironment(env);
super.setUp();
}
protected void tearDown() throws Exception
{
MockContextFactory.setDelegateContext(null);
MockContextFactory.setDelegateEnvironment(null);
super.tearDown();
}
public void testLookupExternal() throws Exception
{
InitialContext context = new InitialContext();
Object object = context.lookup("test");
assertEquals("TestObject", object);
}
}