public class AdminServiceTest extends TestCase {
IAdminService adminService = null;
protected ApplicationContext ac;
@Override
/**
*开始时调用
*/
public void setUp() throws IOException {
ac = new ClassPathXmlApplicationContext("classpath*:applicationContext.xml");
adminService = (IAdminService) ac.getBean("adminServiceBean");
}
@Override
/**
*结束时调用
*/
protected void tearDown() throws Exception {
ComboPooledDataSource dataSource = (com.mchange.v2.c3p0.ComboPooledDataSource) ac.getBean("dataSource");
dataSource.close();
}
public void testAddUser () throws Exception{
//写测试代码
}
写一个Junit类...在Spring中
最新推荐文章于 2024-04-29 13:55:16 发布