Hi,
I have the following JSP (selectone.jsp), containing a single selectOneMenu component:
<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml">
<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
<f:view>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" />
<title>Insert title here</title>
</head>
<body>
<h:form id="selectForm">
<h:selectOneMenu id="selectOne">
<f:selectItem itemValue="One" itemLabel="One"/>
<f:selectItem itemValue="Two" itemLabel="Two"/>
<f:selectItem itemValue="Three"
itemLabel="Three"/>
</h:selectOneMenu>
</h:form>
</body>
</f:view>
</html>
And the following test:
public class SelectTest extends TestCase {
public void testSelectOne() throws Exception {
ClientFacade client = new ClientFacade("/selectone.faces");
client.setParameter("selectOne", "One");
client.submit("submit_button");
assertEquals(200, client.getWebResponse().getResponseCode());
}
}
Running the test results in the following error:
com.meterware.httpunit.IllegalParameterValueException: May not
set parameter 'selectForm:selectOne' to 'One'. 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 org.jboss.jsfunit.facade.ClientFacade.setParameter(ClientFacade.java:155)
It seems like HttpUnit does not correctly see the options for the select menu (hence the
'must be one of: { }).
Am I doing something wrong here or is this a bug?
Thanks,
Pieter.