📄 rightmgmtdaotest.java
字号:
package com.tarena.oss.test;
import java.util.Collection;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.tarena.oss.rights.dao.RightMgmtDAO;
import com.tarena.oss.rights.pojo.Rights;
public class RightMgmtDAOTest extends TestCase {
private RightMgmtDAO dao;
private ApplicationContext context;
public RightMgmtDAOTest(String name) {
super(name);
}
protected void setUp() throws Exception {
context=new ClassPathXmlApplicationContext("applicationContext.xml");
dao=(RightMgmtDAO)context.getBean("rightDAO");
}
protected void tearDown() throws Exception {
context=null;
dao=null;
}
public void testQueryAll() {
Collection<Rights> ps = dao.queryAll();
System.out.println(ps);
}
public void testQueryAllString() {
String qryStr = " where r.name like '%资%' ";
Collection<Rights> ps = dao.queryAll(qryStr);
System.out.println(ps);
}
public void testInsertRight() {
Rights r=new Rights(null,"r","s",null);
dao.insertRight(r);
}
public void testQueryPricingById() {
fail("Not yet implemented");
}
public void testUpdatePricing() {
fail("Not yet implemented");
}
public void testDeletePricing() {
fail("Not yet implemented");
}
public static Test suite(){
TestSuite suite = new TestSuite();
suite.addTest(new RightMgmtDAOTest("testQueryAll"));
suite.addTest(new RightMgmtDAOTest("testQueryAllString"));
suite.addTest(new RightMgmtDAOTest("testInsertRight"));
return suite;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -