I'm trying to write a JUnit test for an Action and I'm having problems with ClassCastExceptions on the findForward() method of ActionMapping. I am not in a position to try any other packages or tools, so I have to roll this one myself.
I have narrowed the problem down to getting the ClassCastException in the following line of the action under test: ActionForward forward = mapping.findForward("success"); A fairly straight-forward thing to do in an Action,so it must be in my setting up of the ActionMapping. Here's the setup in my test: // Now build an ForwardConfig ForwardConfig config = new ForwardConfig("success", "/noOp.jsp", false); config.freeze(); assertEquals("ForwardConfig[name=success,path=/noOp.jsp,redirect=false,contextRelative=false]", config.toString()); The assertEquals passes, so I hope that my ForwardConfig was correct. Here's my setup of the ActionMapping: // Build an ActionMapping for our ForwardConfig ActionMapping mapping = new ActionMapping(); mapping.addForwardConfig(config); // Set remaining attributes mapping.setAttribute("noOpForm"); mapping.setInput("/noOp.jsp"); mapping.setName("noOpForm"); mapping.setPath("/noOp"); mapping.setScope("request"); mapping.setType("com.landsend.ebs.jokertags.actions.NoOpAction"); mapping.freeze(); assertEquals("noOpForm", mapping.getAttribute()); assertEquals("/noOp.jsp", mapping.getInput()); assertEquals("noOpForm", mapping.getName()); assertEquals("/noOp", mapping.getPath()); assertEquals("request", mapping.getScope()); assertEquals("com.landsend.ebs.jokertags.actions.NoOpAction", mapping.getType()); assertEquals("ActionConfig[path=/noOp,attribute=noOpForm,input=/noOp.jsp,name=noOpForm,scope=request,type=com.landsend.ebs.jokertags.actions.NoOpAction", mapping.toString()); Again, all these asserts pass, so I hope that means that my ActionMapping is right. I call the action using the line: ActionForward forward = action.execute(mapping, form, null, null); I'm not using the HttpServletRequest or HttpServletResponse objects in the action, so they're null for now. What am I doing wrong? Simon (the Lands' End guy now using GMail :-) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]