package com.patest.base;
import org.apache.struts2.StrutsSpringTestCase;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
public class BaseJunitTest<T> extends StrutsSpringTestCase{
protected T testObj=null;
protected ApplicationContext ctx=null;
@Override
protected void setUp() throws Exception {
super.setUp();
ctx = new FileSystemXmlApplicationContext("src\\applicationContext.xml");
System.out.println("========== test start ============");
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
System.out.println("========== test end ============");
}
protected T getBean(String beanName){
return testObj=(T) ctx.getBean(beanName);
}
}
Junit 封装
最新推荐文章于 2022-04-12 10:30:00 发布