|
4#
楼主 |
发表于 2010-1-19 16:48:34
|
只看该作者
应该是SSI框架搭建的网站怎么单元测试,比如这个类?
package com.zju.cdpf.web.struts.action;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.zju.cdpf.biz.dao.ibatis.dataobject.Member;
import com.zju.cdpf.biz.dao.ibatis.dataobject.MemberTemp;
import com.zju.cdpf.biz.service.RegisterService;
public class CheckLoginIdAction extends Action {
private RegisterService registerService;
public RegisterService getRegisterService() {
return registerService;
}
public void setRegisterService(RegisterService registerService) {
this.registerService = registerService;
}
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
response.setContentType("text/plain;charset=utf-8");
String loginId=request.getParameter("loginId");
PrintWriter out = response.getWriter();
Member member=new Member();
member.setLoginId(loginId);
MemberTemp mTemp=new MemberTemp();
mTemp.setLoginId(loginId);
boolean b=registerService.getMember(member);
boolean bb=registerService.getMemberTemp(mTemp);
if(b||bb){
out.write("该ID已注册");
}else {
out.write("可以注册");
}
return null;
}
}
[ 本帖最后由 dongxl123 于 2010-1-19 16:49 编辑 ] |
|