Help about com.meterware.httpunit.Illegal ParameterValueException

[email protected]
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <[email protected]>
Hi,
 
 There is a "select control" in my JSP as follows:
   <select name="color">
         <option value="red">Red</option>
      <option value="green">Green</option>
      <option value="blue">Blue</option>
      </select>   
 
    when I run a Test method, I get IllegalParameterValueException, why ?     
    public void testExecute1() throws Exception
    {
 WebConversation wc = new WebConversation();
 WebRequest request = new GetMethodWebRequest("<A href="http://127.0.0.1:8088/struts-cookbook-1.3.8/">http://127.0.0.1:8088/struts-cookbook-1.3.8/</A>");
 WebResponse response = wc.getResponse(request);
 WebLink link = response.getLinkWith("Execute");
 assertNotNull("superLink 'Execute' is null", link);
 
 WebResponse responseOfExecute = link.click();
 WebForm form = responseOfExecute.getFormWithID("simpleForm");
 assertNotNull("form 'simpleForm' is null", form);
        
    assertTrue("no parameter named 'color'", form.hasParameterNamed("color"));       
    form.setParameter("color", "green"); // throws IllegalParameterValueException
    }
 
 
Exception stack trace:
com.meterware.httpunit.IllegalParameterValueException: May not set parameter 'color' to 'blue'. Value must be one of: {  }
 at com.meterware.httpunit.SelectionFormControl$Options.reportNoMatches(FormControl.java:1186)
 at com.meterware.httpunit.SelectionFormControl$SingleSelectOptions.claimUniqueValues(FormControl.java:1360)
 at com.meterware.httpunit.SelectionFormControl$Options.claimUniqueValues(FormControl.java:1178)
 at com.meterware.httpunit.SelectionFormControl.claimUniqueValue(FormControl.java:1059)
 at com.meterware.httpunit.FormParameter.setValues(FormParameter.java:90)
 at com.meterware.httpunit.WebForm.setParameter(WebForm.java:612)
 at com.meterware.httpunit.WebForm.setParameter(WebForm.java:601)
 at com.struts.Test1.testExecute1(Test1.java:35)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at junit.framework.TestCase.runTest(TestCase.java:154)
 at junit.framework.TestCase.runBare(TestCase.java:127)
 at junit.framework.TestResult$1.protect(TestResult.java:106)
 at junit.framework.TestResult.runProtected(TestResult.java:124)
 at junit.framework.TestResult.run(TestResult.java:109)
 at junit.framework.TestCase.run(TestCase.java:118)
 at junit.framework.TestSuite.runTest(TestSuite.java:208)
 at junit.framework.TestSuite.run(TestSuite.java:203)
 
    Thanks a lot.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.