ActionMapping mapping = createMock(ActionMapping.class);
HttpServletRequest request = createMock(HttpServletRequest.class);
HttpSession session = createMock(HttpSession.class);
ModuleConfig moduleConfig = createMock(ModuleConfig.class);
ActionServlet servlet = createMock(ActionServlet.class);
ServletContext context = createMock(ServletContext.class);
MessageResources messageResources = createMock(MessageResources.class);
DelegatingForm form = createStrictMock(DelegatingForm.class);
action.setServlet(servlet);
actionBean.preBind();
form.bindInwards(actionBean);
expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
expect(mapping.getParameter()).andReturn("method");
expect(request.getParameter("method")).andReturn("Insert Stuff Here");
expect(request.getSession(false)).andReturn(session);
expect(session.getAttribute(Globals.LOCALE_KEY)).andReturn(Locale.getDefault());
expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
expect(moduleConfig.findMessageResourcesConfigs()).andReturn(new MessageResourcesConfig[]
{
new MessageResourcesConfig()
});
expect(servlet.getServletContext()).andReturn(context);
expect(request.getAttribute(Globals.MODULE_KEY)).andReturn(moduleConfig);
expect(moduleConfig.getPrefix()).andReturn("");
expect(context.getAttribute(Globals.MESSAGES_KEY)).andReturn(messageResources);
expect(messageResources.getMessage(Locale.getDefault(), "insert.key")).andReturn("Insert Stuff Here");
expect(actionBean.insert()).andReturn("inserted");
expect(mapping.findForward("inserted")).andReturn(actionForward);
replay(actionBean);