struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rebecca Case <mrc...@yahoo.com>
Subject Struts2 Convention plugin with junit plugin
Date Sat, 15 May 2010 15:47:08 GMT
I'm using Struts 2.8.1 using the convention plugin and attemption to junit test this by utilizing
StrutsSpringTestCase. The problem I'm experiencing is that the test throws an exception saying
"No result defined for action com.becky.action.HowdyFolksAction and result success" if I don't
use a Results annotation for "success" instead of just letting it find the correct jsp (which
seems to sort of at least partially defeat the purpose). 

Here's the test: 

public class HowdyActionTest extends StrutsSpringTestCase {
private String result;

public void testStufftest() throws Exception{
ActionProxy proxy = getActionProxy("/howdy-folks.cfx");
try{
result = proxy.getInvocation().invoke();
} catch(Exception e){
e.printStackTrace();
}
HowdyFolksAction action = (HowdyFolksAction) proxy.getAction();
System.out.println("result: " + result);
}
@Override
protected String getContextLocations() {
return "classpath:applicationContext.xml";
}
}
and here's the action 

//@Results({
//@Result(name="success", location="howdy-folks.jsp")
//})
public class HowdyFolksAction extends ActionSupport{
private static final long serialVersionUID = 1L;

public String execute(){
System.out.println("I'm here y'all");
return SUCCESS;
}
}

Am I missing something or is it just that these plugins don't completely play well together?


Also, this is my first time using this list, so I apologize if I'm posting this to the wrong
list or am doing something wrong here.


      

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message