zoukankan      html  css  js  c++  java
  • Spring 下使用Junit4 单元测试

    package platform;
    
    
    import java.util.List;
    import java.util.UUID;
    
    import javax.annotation.Resource;
    
    import org.apache.commons.codec.digest.DigestUtils;
    import org.junit.Test;
    import org.junit.runner.RunWith;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.test.context.ContextConfiguration;
    import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
    import org.springframework.test.context.web.WebAppConfiguration;
    import com.xxx.xxx.model.ProjectInfo;
    import com.xxx.xxx.service.ProjectInfoService;
    
    @RunWith(SpringJUnit4ClassRunner.class)
    @ContextConfiguration(locations = {"classpath:applicationContext.xml"})
    @WebAppConfiguration
    public class JunitTest {
    //    @Resource
        @Autowired
        private ProjectInfoService projectInfoService;
    
         @Test
         public void demo2(){
            ProjectInfo projectInfo = projectInfoService.findProjectInfoById("ID");
            System.out.println(projectInfo.getName());
         }
    }

    不写单元测试的程序员不是好程序员。

  • 相关阅读:
    数据库基础-INDEX
    LINQ教程
    NPOI导出EXCEL
    WPF数据双向绑定
    WPF控件数据单项绑定
    HelloWorld IL代码
    Python基础教程(英文视频教学)
    ado.net的5个主要对象
    Linux学习-0627
    C#中Abstract和Virtual
  • 原文地址:https://www.cnblogs.com/jkwll/p/10677015.html
Copyright © 2011-2022 走看看