📄 trainsummaryactiontest.java
字号:
package org.HumResManSys.action;
import static org.junit.Assert.*;
import java.io.File;
import javax.servlet.http.HttpSession;
import org.HumResManSys.factory.ServiceFactory;
import org.HumResManSys.service.EmployeeService;
import org.HumResManSys.vo.Employee;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import servletunit.struts.MockStrutsTestCase;
public class TrainSummaryActionTest extends MockStrutsTestCase{
@Before
public void setUp() throws Exception {
super.setUp();
this.setContextDirectory(new File("WebRoot"));
}
@Test
public void testAddTrainEvaluation() {
setRequestPathInfo("/TrainSummaryAction");
addRequestParameter("method","addTrainEvaluation");
addRequestParameter("summary","very good!");
ApplicationContext ac=
new ClassPathXmlApplicationContext("/applicationContext.xml");
EmployeeService emp=(EmployeeService)ac.getBean("EmployeeService");
Employee oneEmpInfo = emp.showSelfInfos("王春来");
HttpSession session=this.getSession();
session.setAttribute("oneEmpInfo",oneEmpInfo);
actionPerform();
verifyForward("PXDetailSuccess");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -