我是靠谱客的博主 坦率电脑,最近开发中收集的这篇文章主要介绍在Eclipse中使用JUnit4进行单元测试(spring中调用DAO),觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

参考 :http://blog.csdn.net/andycpp/article/details/1327147/   
http://blog.csdn.net/zhangzikui/article/details/11071881

jar包下载 http://www.jb51.net/codes/539546.html

package com.zte.quartz;

import javax.annotation.Resource;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.transaction.annotation.Transactional;

import com.zte.supplier.dao.SupplierModifyDao;


@RunWith(SpringJUnit4ClassRunner.class)  
@ContextConfiguration(locations={"classpath:spring-config.xml","classpath:spring-mvc.xml"}) 
public class QuartzJobSupplierRefreshAvlTest {

	@Resource
	private SupplierModifyDao supplierModifyDao;
	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void testWork() {
		String emailEmp = supplierModifyDao.getEmailEmp("1cea0c32-2529-4ed1-9ae1-2953606b6bc3"); // 获得邮件接收人
		System.out.println(emailEmp);
	}

}

最后

以上就是坦率电脑为你收集整理的在Eclipse中使用JUnit4进行单元测试(spring中调用DAO)的全部内容,希望文章能够帮你解决在Eclipse中使用JUnit4进行单元测试(spring中调用DAO)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(38)

评论列表共有 0 条评论

立即
投稿
返回
顶部