📄 admindaotest.java
字号:
package org.wiely.dao.impl;
import junit.framework.TestCase;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.wiely.dao.AdminDAO;
import org.wiely.vo.Admin;
public class AdminDAOTest extends TestCase {
private Admin admin;
private AdminDAO adminDAO;
@Override
protected void setUp() throws Exception {
ApplicationContext context = new FileSystemXmlApplicationContext(
"classpath:applicationContext.xml");
admin = new Admin();
admin.setAdminname("wiely");
admin.setAdminpassword("123456");
admin.setScore(20);
admin.setPhone("123456789");
adminDAO = (AdminDAO) context.getBean("adminDAO");
}
public void testCheckAdmin() throws Exception {
Admin admin1 = adminDAO.checkAdmin(admin);
assertNotNull(admin1);
}
public void testExitsAdmin() throws Exception {
String adminname = "wiely";
boolean b;
b = adminDAO.exitsAdmin(adminname);
assertTrue(b);
}
public void testIsMaxScore() throws Exception {
int adminid =1;
boolean b;
b = adminDAO.isMaxScore(adminid);
assertTrue(b);
}
public void testRegister() throws Exception {
adminDAO.register(admin);
}
@Override
protected void tearDown() throws Exception {
admin = null;
adminDAO = null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -