📄 reseacherdaotest.java
字号:
package com.wiely.dao;
import java.util.List;
import junit.framework.TestCase;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import com.wiely.vo.Reseacher;
public class ReseacherDAOTest extends TestCase {
@SuppressWarnings("unchecked")
List l;
int currentPage, pageSize;
boolean b;
protected Reseacher reseacher;
protected ReseacherDAO reseacherDAO;
public void setUp() throws Exception {
currentPage = 2;
pageSize = 2;
reseacher = new Reseacher();
reseacher.setCareer("test for career");
reseacher.setName("test");
reseacher.setSex("female");
reseacher.setTitle("test");
ApplicationContext context = new FileSystemXmlApplicationContext(
"classpath:com/wiely/dao/applicationContext.xml");
reseacherDAO = (ReseacherDAO) context.getBean("reseacherDAO");
}
public void testSaveReseacher() throws Exception {
b=reseacherDAO.saveResearcher(reseacher);
assertTrue(b);
}
public void testGetReseacher() throws Exception {
l = reseacherDAO.getReseacher(currentPage, pageSize);
assertNotNull(l);
}
public void testDeleteReseacher() throws Exception{
b=reseacherDAO.delReseacher(7);
assertTrue(b);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -