spring 单元测试

小南超子 发布于 2015/09/16 15:18
阅读 449
收藏 0

开源之夏第三届火热来袭,高校学生参与赢万元奖金!>>>

运行完后,数据没有插入到数据库里面。

软件运行环境:Spring Framework 4.0、MyBatis 3.2

控制台打印信息:

2015-09-16 14:48:38,053 WARN  [org.springframework.aop.framework.CglibAopProxy] - Unable to proxy method [public final void org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests.setApplicationContext(org.springframework.context.ApplicationContext)] because it is final: All calls to this method via a proxy will NOT be routed to the target instance.
2015-09-16 14:48:38,202 DEBUG [modules.dynamic.dao.CourseTimeResultDao.insertCourseResult] - ==>  Preparing: INSERT INTO basis_timeresult( trclaid, trcrsid, trtchid, trweekid, trweekn, trhours, trroomid ) SELECT ?, ?, ?, ?, ?, ?, ? FROM dual union all SELECT ?, ?, ?, ?, ?, ?, ? FROM dual union all SELECT ?, ?, ?, ?, ?, ?, ? FROM dual union all SELECT ?, ?, ?, ?, ?, ?, ? FROM dual union all SELECT ?, ?, ?, ?, ?, ?, ? FROM dual union all SELECT ?, ?, ?, ?, ?, ?, ? FROM dual union all SELECT ?, ?, ?, ?, ?, ?, ? FROM dual union all SELECT ?, ?, ?, ?, ?, ?, ? FROM dual union all SELECT ?, ?, ?, ?, ?, ?, ? FROM dual union all SELECT ?, ?, ?, ?, ?, ?, ? FROM dual union all SELECT ?, ?, ?, ?, ?, ?, ? FROM dual union all SELECT ?, ?, ?, ?, ?, ?, ? FROM dual 
2015-09-16 14:48:38,280 DEBUG [modules.dynamic.dao.CourseTimeResultDao.insertCourseResult] - ==> Parameters: 1(String), 1(String), 1(String), 1(String), 1(String), 3(String), 1(String), 1(String), 1(String), 1(String), 1(String), 1(String), 4(String), 1(String), 1(String), 1(String), 1(String), 1(String), 2(String), 3(String), 1(String), 1(String), 1(String), 1(String), 1(String), 2(String), 4(String), 1(String), 1(String), 1(String), 1(String), 1(String), 3(String), 3(String), 1(String), 1(String), 1(String), 1(String), 1(String), 3(String), 4(String), 1(String), 1(String), 1(String), 1(String), 2(String), 1(String), 3(String), 1(String), 1(String), 1(String), 1(String), 2(String), 1(String), 4(String), 1(String), 1(String), 1(String), 1(String), 2(String), 2(String), 3(String), 1(String), 1(String), 1(String), 1(String), 2(String), 2(String), 4(String), 1(String), 1(String), 1(String), 1(String), 2(String), 3(String), 3(String), 1(String), 1(String), 1(String), 1(String), 2(String), 3(String), 4(String), 1(String)
2015-09-16 14:48:38,609 DEBUG [modules.dynamic.dao.CourseTimeResultDao.insertCourseResult] - <==    Updates: 12
2015-09-16 14:48:38,655 DEBUG [thinkgem.jeesite.common.utils.SpringContextHolder] - 清除SpringContextHolder中的ApplicationContext:org.springframework.context.support.GenericApplicationContext@424127cf: startup date [Wed Sep 16 14:48:33 CST 2015]; root of context hierarchy




加载中
0
我去又空指针
我去又空指针
该评论暂时无法显示,详情咨询 QQ 群:点此入群
小南超子
小南超子
回复 @我去又空指针 : 嗯呢,受教了。谢谢
我去又空指针
我去又空指针
回复 @小南超子 : 一般单元测试数据都不会入库,验证是否插入数据,正确的做法是直接在测试方法里下进行select,然后断言。要多看下spring官网的github的测试项目里面的写法
小南超子
小南超子
加上,确实是可以了。但是为什么会事务回滚了呢?还有打印的第一句说我:代理了final类是什么回事呢?求解答
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部