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());
         }
    }

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

  • 相关阅读:
    BUGFREE安装等
    常用网站
    Mongodb
    python资源
    HTTP协议详解(经典)
    Jmeter工具
    一.移动app测试与质量保证
    我发现涯哥特有才。各种跳,组合式
    原来如此
    我真庆幸我看过那本书。
  • 原文地址:https://www.cnblogs.com/jkwll/p/10677015.html
Copyright © 2011-2022 走看看