spring项目中怎么实现单元测试

本篇文章给大家分享的是有关spring项目中怎么实现单元测试,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

创新互联公司2013年成立,是专业互联网技术服务公司,拥有项目成都网站设计、网站建设网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元阿荣做网站,已为上家服务,为阿荣各地企业和个人服务,联系电话:18982081108

import org.junit.Test;import org.junit.runner.RunWith;import org.springframework.test.context.ContextConfiguration;import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;@RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration(locations={    "classpath:application-context.xml",    "classpath:application-database.xml",    "classpath:application-redis.xml"})public class PartRelevanceTest {@Resource  private PartRelevanceMapper partRelevanceMapper;@Test  public void selectTypeNumOne() {PartRelevanceTypeNum record = new PartRelevanceTypeNum();record.setRelCode("2222112");record.setType("2");PartRelevanceTypeNum typeNum = partRelevanceMapper.selectTypeNumOne(record);System.out.println(typeNum==null?"typeNum-数据为空":typeNum.toString());}}

以上就是spring项目中怎么实现单元测试,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注创新互联行业资讯频道。


本文名称:spring项目中怎么实现单元测试
链接地址:http://csdahua.cn/article/ipdjpj.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流