public void testSource()
{
Class actionBeanClass = TestAction.class;
ServletContext servletContext = createStrictMock(ServletContext.class);
WebApplicationContext wac = createStrictMock(WebApplicationContext.class);
expect(servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE))
.andReturn(wac);
expect(wac.isSingleton("beanName")).andReturn(false);
expect(wac.getBean("beanName", TestAction.class)).andReturn(new TestAction());
// second call - note that isSingleton is not called second time
expect(servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE))
.andReturn(wac);
expect(wac.getBean("beanName", TestAction.class)).andReturn(new TestAction());
replay(servletContext);
replay(wac);
SpringActionBeanSource source = new SpringActionBeanSource(actionBeanClass, "beanName");