I´m trying to test the action below :
public class FamiliaDNCAction extends BasicAction {
public ActionForward unspecified(ActionMapping actionMapping, ActionForm
actionForm, HttpServletRequest request, HttpServletResponse response) throws
BusinessException {
Set msgs = new HashSet();
return loadPage(actionMapping,actionForm,request,response);
}
public ActionForward loadPage(ActionMapping actionMapping, ActionForm
actionForm, HttpServletRequest request, HttpServletResponse response) throws
BusinessException {
HttpSession session=request.getSession();
CadastroFamiliaDNC cad = new CadastroFamiliaDNC();
FamiliaDNCForm form = (FamiliaDNCForm) actionForm;
List dados = cad.findByCodigoDependencia(form.getCodDependencia().intValue());
session.setAttribute("dadosdnc",dados);
return actionMapping.findForward("inicial");
}
}
The parameters for the action are
FamiliaDNC.do -- calls the class
ev --> the parameter for the method, when not set calls "unspecified" method
public class TestFamiliaDNCAction extends MockStrutsTestCase{
FamiliaDNCAction fdnca;
public TestFamiliaDNCAction(String nomeDoTeste) {
super(nomeDoTeste);
}
public void setUp() throws Exception {
super.setUp();
fdnca = new FamiliaDNCAction();
}
public void testLoadPage() {
addRequestParameter("codDependencia","1");
addRequestParameter("codTipoFamiliaInsumo","0");
addRequestParameter("ev","unspecified");
setRequestPathInfo("/corporativo/cadastro/cadFamiliaDNC");
actionPerform();
verifyForward("inicial");
verifyForwardPath("/corporativo/cadastro/corp_cad_familia_dnc.jsp");
verifyNoActionErrors();
}
I´m getting nullPointerException, when i try to test it. I´m not sure
witch parameters i add to the request for example in the action form i have:
.
/form>
My question is, witch parameters do i put in the addRequestParameter("?","?"); ?
any clue ?
Thanks in advance
regards..
Luiz Octavio Godoy
Desenvolvimento de Sistemas
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com