所有资源的路径,我疑惑Struts2的动作单元测试无法获取类路径的资源
import org.apache.struts2.StrutsSpringTestCase;
import org.junit.Test;
import com.opensymphony.xwork2.ActionProxy;
public class TestLoginAction extends StrutsSpringTestCase {
@Test
public void testCheck() throws Exception {
ActionProxy proxy = null;
LoginAction test = null;
request.setParameter("username", "admin");
proxy = getActionProxy("/checkLogin");
test = (LoginAction) proxy.getAction();
String result = proxy.execute();
assertEquals("error", result);
assertEquals("admin", test.getUsername());
}
}
它抛出的警告和例外情况:
无法获取资源的路径对于类路径的资源[WEB-INF/JSP /] java.io.FileNotFoundException:类路径资源[WEB-INF/JSP /]不能被解析到URL,因为它不存在
如果此问题解决了问题,请使用此问题右侧的复选标记标记为选定答案。 – ahsteele