Hi,
When i have to put some values in DynaValidatorForm i
do the following to instantiate it in struts1.1b2
DynaValidatorForm PL1820UpdateForm = 
                      (DynaValidatorForm)
DynaActionFormClass.getDynaActionFormClass(
                                        
"PL1820UpdateForm").newInstance();

Where PL1820UpdateForm is form definiation in
struts-config file.
I think this method of instantiating has been shcnage
in struts1.1b3 
People correct me if i am wrong
Ashish



--- "Kilmer, Erich" <[EMAIL PROTECTED]>
wrote:
> Hello,
> I am trying to Junit test my Struts code. Not sure
> how many people have
> tried to do this. If there is a more appropriate
> forum to send this to
> please let me know.
> Here is my test code. When it gets to:
> dynaValidatorForm.set("areaId",
> "-1"); it crashes.
> I never tried to instantiate a DynaValidatorForm
> before (I always just cast
> ActionForm in the action method to a
> DynaValidatorForm).
> Is there something tricky about instantiating a
> DynaValidatorForm ?
> 
>    public void testSaveEdit()
>    {
>       try
>       {
>          appbean.login("admin", "project");
>          addRequestParameter("method","Save");
>          addRequestParameter("areaId","-1");
>          setRequestPathInfo("/saveArea.do");
>          DynaValidatorForm dynaValidatorForm = new
> DynaValidatorForm();
>          dynaValidatorForm.set("areaId", "-1");
>          dynaValidatorForm.set("description",
> "area1");
>         
>
dynaValidatorForm.set("projectCoordinatorContactName",
> "new name
> 1");
>         
>
dynaValidatorForm.set("projectCoordinatorContactPhoneNumber",
> "new
> number 1");
>         
>
dynaValidatorForm.set("maintenanceManagerContactName",
> "new name
> 2");
>         
>
dynaValidatorForm.set("maintenanceManagerContactPhoneNumber",
> "new
> number 2");
>          setActionForm(dynaValidatorForm);
>          actionPerform();
>          verifyForward("success");
>          verifyNoActionErrors();
>          verifyActionErrors(new
> String[]{"message.saved"});
>          appbean.logout();
> 
>       }
>       catch(Exception e)
>       {
>           fail("Unexpected Exception - " +
> e.getMessage());
>       }
>    }
> 
> 


=====
A$HI$H

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to