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. ...
随机推荐
- 如何让ios启动画面停留更长时间
几种方法: 方法1:在AppDelegate.m里写上 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithO ...
- Netty处理TCP拆包、粘包
Netty实践(二):TCP拆包.粘包问题-学海无涯 心境无限-51CTO博客 http://blog.51cto.com/zhangfengzhe/1890577 2017-01-09 21:56: ...
- window 如何枚举设备并禁用该设备和启用该设备?如何注册设备热拔插消息通知?
目前实现的功能: 1.设备枚举 2.设置设备禁用和启用 3.注册设备热拔插消息通知 4.获取设备 vid pid 数值 需要链接的库 SetupAPI.lib DeviceManager 类如下: D ...
- 【react表格组件】material-table 基本用法 & 组件override
教程: https://mbrn.github.io/material-table/#/ https://material-ui.com/api/table/ github: https://gith ...
- Redis应用案例,查找某个值的范围(转)
原文:https://groups.google.com/forum/#!topic/redis-db/lrYbkbxfQiQ 本文来自Redis在Google Group上的一个问题,有一位同学发贴 ...
- qemu网络虚拟化之数据流向分析二
2016-09-27 上篇文章大致介绍了qemu网络虚拟化相关的数据结构,本篇就结合qemu-kvm源代码分析下各个数据结构是如何初始化以及建立联系的. 这里还是分为三个部分: 1.Tap设备区 2. ...
- Linux下桥接模式详解一
注册博客园已经好长时间,一直以来也没有在上面写过文章,都是随意的记录在了未知笔记上,今天开始本着分享和学习的精神想把之前总结的笔记逐步分享到博客园,和大家一起学习,一起进步吧! 2016-09-20 ...
- 基于flask的代码上传
from flask import Flask,Blueprint,request,render_template from flask import current_app as app from ...
- JSON-RPC(jsonrpc4j)使用demo
服务端开发,在很多情况下,需要使用到RPC框架,今天发现一款很轻量的RPC框架--JSON-RPC.json rpc 是一种以json为消息格式的远程调用服务,它是一套允许运行在不同操作系统.不同环境 ...
- MySQL 温故知心(一)
1.创建表 SET NAMES utf8; ; -- ---------------------------- -- Table structure for `employee_tbl` -- --- ...