ok no answers so i guess there is no solution jet.
i think the best way is to mock the request. but then there is some
refactoring needed can i change this:
baseAction
/**
* Convenience method to get the request
* @return current request
*/
protected HttpServletRequest getRequest() {
return ServletActionContext.getRequest();
}
to:
private request;//with a setter
protected HttpServletRequest getRequest() {
if(request!=null){
return request
}
return ServletActionContext.getRequest();
}
or even:
private request;//with a setter
protected HttpServletRequest getRequest() {
if(request==null){
request = ServletActionContext.getRequest();
}
return request;
}
thanks
tibi
i did not look at it jet but is there already a solution for testing a
method like this:
useraction:
public String edit() throws IOException {
final HttpServletRequest request = getRequest();
final boolean editProfile =
(request.getRequestURI().indexOf("editProfile") > -1);
// if URL is "editProfile" - make sure it's the current user
if (editProfile
......
becasue the getReqeust will not work in a junit test....
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]