}
public void testGetTargetObjectSetsThreadContextClassloader() throws Exception {
final ClassLoader cl = EasyMock.createMock(ClassLoader.class);
final EJBObject ejb = EasyMock.createMock(EJBObject.class);
JCABusFactory rai = EasyMock.createMock(JCABusFactory.class);
InitialContext ic = EasyMock.createMock(InitialContext.class);
ClassLoader current = Thread.currentThread().getContextClassLoader();
ic.lookup(EasyMock.isA(String.class));
EasyMock.expectLastCall().
andReturn(new ThreadContextCheckerHome((Object)ejb, (ClassLoader)current, this)).anyTimes();
EasyMock.replay(ic);
rai.setBus(null);
EasyMock.expectLastCall();
rai.getBus();
EasyMock.expectLastCall().andReturn(null);
rai.getInitialContext();
EasyMock.expectLastCall().andReturn(ic);
rai.getAppserverClassLoader();
EasyMock.expectLastCall().andReturn(cl).andReturn(current);
// retrun current classloader for getTargetObject pass
EasyMock.replay(rai);