成都网站建设设计

将想法与焦点和您一起共享

spring项目中怎么实现单元测试-创新互联

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

目前创新互联已为数千家的企业提供了网站建设、域名、网页空间、网站运营、企业网站设计、江华网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。
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://chengdu.cdxwcx.cn/article/csdehg.html