系统:WinAll 大小:101KB
类型:编程软件 更新:2016-05-29

junit4.4.jar小编试过了,简单的测试了几个类,暂时没有什么问题,本来用的是4.1版本,出了莫名的错误,现在换成了4.4 ,没哟错误消失了,不知道是不是bug,这个版本很不错。
将配置项都写在父类中,测试子类继承该AbstractTestCase类, 测试的时候,不会导致数据库数据污染 ,因为继承AbstractTransactionalDataSourceSpringContextTests每次数据库操作完成之后都会回滚。
public class TransFlowServiceTests extends AbstractTestCase { @Autowired TransFlowService transFlowService;
@Test
public void testQueryTransFlow() {
Map map = new HashMap();
PageBean pb = new PageBean(1, 20, 10);
map.put("pb", pb);
List<TransFlow> lis = transFlowService.queryTransFlow(map);
for (TransFlow tf : lis) {
System.out.println(tf.getOrderNo() + "-" + tf.getStatus() + "-" + tf.getStatusView() + "-" + tf.getOrderTime() + "-" + tf.getOrderTimeView());
} }
@Test
public void testGetTransFlowCount() {
Map map = new HashMap();
PageBean pb = new PageBean(1, 20, 10);
map.put("pb", pb);
int i = transFlowService.getTransFlowCount(map);
System.err.println("i="+i);
}
@Test
public void testGetTransFlowNum() {
int j = transFlowService.getTransFlowNum();
System.out.println("j="+j);
}
@Test
public void testUpdateTransFlowStatus() {
int k = transFlowService.updateTransFlowStatus();
System.err.println("k="+k);
}
}