📄 cstcustomerbiztest.java
字号:
package test.y308.team3.biz;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.List;
import org.jb.y2t308.team3.biz.CstCustomerBiz;
import org.jb.y2t308.team3.entity.CstCustomer;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class CstCustomerBizTest {
@BeforeClass
public static void setUpBeforeClass() throws Exception {
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
}
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void testGetList() {
ApplicationContext cox = new ClassPathXmlApplicationContext(
"applicationContext.xml");
CstCustomerBiz CstCustomer = (CstCustomerBiz) cox.getBean("customerBiz");
CstCustomer item = new CstCustomer();
String hql="from CstCustomer";
List list=CstCustomer.getCommonDAO().list(hql);
System.out.println("==================总共查到客户信息"+list.size()+"条");
}
@Test
public void testUpdate() {
ApplicationContext cox = new ClassPathXmlApplicationContext(
"applicationContext.xml");
CstCustomerBiz CstCustomer = (CstCustomerBiz) cox.getBean("customerBiz");
boolean re = true;
CstCustomer item = new CstCustomer();
String hql="from CstCustomer";
List list=CstCustomer.getCommonDAO().list(hql);
CstCustomer customer=(CstCustomer) list.get(0);
customer.setCustManagerName("哈哈哈哈");
try {
CstCustomer.update(customer);
} catch (Exception e) {
e.getMessage();
re = false;
}
assertTrue(re);
}
//@Test
public void testGet() {
fail("Not yet implemented");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -