spring junit4 测试
@Service
@ContextConfiguration(locations = {
"classpath:config/applicationContext.xml"
})
@RunWith(SpringJUnit4ClassRunner.class)
@TransactionConfiguration(transactionManager="transactionManager", defaultRollback=false)
public class UnionCardServiceImpl implements UnionCardService { @Autowired
private UnionMemberMapper unionMemberMapper; @Test
@Transactional(rollbackFor = Exception.class)
public void updateDemo(){
UnionMember member = new UnionMember();
member.setId();
member.setDelStatus();
unionMemberMapper.updateByPrimaryKeySelective(member);
updateForMaop();
} public void updateForMaop(){
//System.out.println(1/0);//测试异常情况
UnionMember member = new UnionMember();
member.setId();
member.setDelStatus();
unionMemberMapper.updateByPrimaryKeySelective(member);
} }
spring junit4 测试的更多相关文章
- 使用Spring+Junit4.4进行测试(使用注解)
http://nottiansyf.iteye.com/blog/345819 使用Junit4.4测试 在类上的配置Annotation @RunWith(SpringJUnit4ClassRunn ...
- 用Spring+Junit4.4进行测试(使用注解)
http://nottiansyf.iteye.com/blog/345819 使用Junit4.4测试 在类上的配置Annotation @RunWith(SpringJUnit4ClassRunn ...
- web项目中 集合Spring&使用junit4测试Spring
web项目中 集合Spring 问题: 如果将 ApplicationContext applicationContext = new ClassPathXmlApplicationContext(& ...
- Junit4测试Spring
使用Junit4.4测试 在类上的配置Annotation @RunWith(SpringJUnit4ClassRunner.class) 用于配置spring中测试的环境 @ContextCon ...
- 使用Spring+Junit4.4进行测试
http://nottiansyf.iteye.com/blog/345819 使用Junit4.4测试 在类上的配置Annotation @RunWith(SpringJUnit4ClassRunn ...
- Spring TestContext测试框架搭建
同样是测试,JUnit和Spring TestContext相比,Spring TestContext优势如下: 1.Spring TestContext可以手动设置测试事务回滚,不破坏数据现场 2. ...
- Spring Boot(七):spring boot测试介绍
首先maven要引入spring-boot-starter-test这个包. 先看一段代码 @RunWith(SpringRunner.class) @SpringBootTest(webEnviro ...
- Spring Junit4 接口测试
Junit实现接口类测试 - dfine.sqa - 博客园http://www.cnblogs.com/Automation_software/archive/2011/01/24/1943054. ...
- spring + junit 测试
spring + junit 测试 需要一个工具类 package com.meizu.fastdfsweb; import org.junit.runner.RunWith; import org. ...
随机推荐
- 忽略UserInterfaceState.xcuserstate
GIT忽略iOS项目UserInterfaceState.xcuserstate 1.删除仓库中跟踪的UserInterfaceState.xcuserstate git rm --cached ...
- 粘性会话 session affinity sticky session requests from the same client to be passed to the same server in a group of servers
Module ngx_http_upstream_module http://nginx.org/en/docs/http/ngx_http_upstream_module.html#sticky S ...
- python AI(numpy,matplotlib)
http://blog.csdn.net/ywjun0919/article/details/8692018 apt-cache policy python-numpy sudo apt-get in ...
- RHEL6.×配置Centos YUM源
Step1: 清除原有的yum源rpm -aq|grep yum|xargs rpm -e --nodeps Step2:下载新的yum()源进行安装,注意操作系统支持64位还是32位wget htt ...
- 重点:怎样正确的使用QThread类(很多详细例子的对比,注意:QThread 中所有实现的函数是被创建它的线程来调用的,不是在线程中)good
背景描述: 以前,继承 QThread 重新实现 run() 函数是使用 QThread唯一推荐的使用方法.这是相当直观和易于使用的.但是在工作线程中使用槽机制和Qt事件循环时,一些用户使用错了.Qt ...
- 【opencv安裝】opencv2和opencv3共存——安装opencv2和opencv3到指定目录
安装 opencv2和opencv3共存会导致运行时问题,须分开 下载源码 cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/hom ...
- Android适配不同的设备
感谢原作者的整理: http://blog.csdn.net/chenyjays/article/details/41308887 适配不同的语言 把UI中的字符串存储在外部文件,通过代码提取. 创建 ...
- C++入门(1)
#include<>直接从编译器自带的函数库中寻找文件 #include""是先从自定义的文件中找 ,如果找不到在从函数库中寻找文件 采用"< > ...
- Linux登录欢迎图案
命令提示符设置: export PS1='\n\[\e[37;1m[\]\[\e[31;1m\]\u\[\e[39;1m\]@\[\e[33;1m\]\H \[\e[34;1m\]\w\[\e[37; ...
- 理解tomcat之搭建简易http服务器
做过java web的同学都对tomcat非常熟悉.我们在使用tomcat带来的便利的同时,是否想过tomcat是如何工作的呢?tomcat本质是一个http服务器,本篇文章将搭建一个简单的http服 ...