-
1. Re: SeamTest with Enum @RequestParameter
pmuir May 12, 2008 4:49 PM (in response to abagchi)Try using page parameters instead as they allow you to specify a converter.
-
2. Re: SeamTest with Enum @RequestParameter
cretz Apr 23, 2009 10:42 PM (in response to abagchi)I too suffer from this, but I don't understand your meaning by using page parameters. If I use setPageParameter from my test, it doesn't populate @RequestParameter. I wasn't wanting to change the code to support my tests. I have a piece of jsf [kinda] like so:
<ui:repeat value="#{action.items}" var="item"> <ice:outputText value="#{item.name}" /> <ice:commandLink value="Do Something" action="#{action.doSomething}"> <f:param name="someEnum" value="#{item.someEnum}" /> </ice:commandLink> </ui:repeat>
w/
@RequestParameter
MyEnum someEnum;What would be the best way to test the doSomething action which needs these request parameters? I've tried to add a custom converter to Conversions in my test case and it didn't help. Thanks for any help you can give.
-
3. Re: SeamTest with Enum @RequestParameter
sstruyve Apr 29, 2011 4:25 AM (in response to abagchi)While trying to google a solution for this problem it seems nobody has a usefull answer.
However, after a little trying I found a solution myself, and I believe that posting the answer here
can be usefull for anyone still suffering this problem.I created a converter (MyEnumConverter implements javax.faces.convert.Converter)
and then used
request.getFacesContext().getApplication().addConverter(MyEnum.class, MyEnumConverter.class.getName()); request.setParameter("myEnumParam", MyEnum.VALUE.toString());
where request is the FacesRequest (or NonFacesRequest)
-
4. Re: SeamTest with Enum @RequestParameter
sstruyve Apr 29, 2011 4:25 AM (in response to abagchi)While trying to google a solution for this problem it seems nobody has a usefull answer.
However, after a little trying I found a solution myself, and I believe that posting the answer here
can be usefull for anyone still suffering this problem.I created a converter (MyEnumConverter implements javax.faces.convert.Converter)
and then used
request.getFacesContext().getApplication().addConverter(MyEnum.class, MyEnumConverter.class.getName()); request.setParameter("myEnumParam", MyEnum.VALUE.toString());
where request is the FacesRequest (or NonFacesRequest)