zoukankan      html  css  js  c++  java
  • springBoot_freemark配置

    Spring Boot test

    1、添加依赖

    <!-- 引入 spring-boot-starter-test 集成单元测试-->
    
    <dependency>
    
    <groupId>org.springframework.boot</groupId>
    
    <artifactId>spring-boot-starter-test</artifactId>
    
    <version>1.5.6.RELEASE</version>
    
    </dependency>

    2、编写单元测试类 

    package com.springboot.junit;
    
     
    
    import java.util.List;
    
     
    
    import org.junit.Test;
    
    import org.junit.runner.RunWith;
    
    import org.springframework.beans.factory.annotation.Autowired;
    
    import org.springframework.boot.test.context.SpringBootTest;
    
    import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
    
     
    
    import com.springboot.Application;
    
    import com.springboot.domain.User;
    
    import com.springboot.mapper.UserMapper;
    
     
    
    @RunWith(SpringJUnit4ClassRunner.class)
    
    @SpringBootTest(classes={Application.class})
    
    public class UserTest {
    
    @Autowired
    
    private UserMapper userMapper;
    
     
    
    @Test
    
    public void testMapper() {
    
    List<User> list = userMapper.findUserList();
    
    System.out.println(list);
    
    }
    
     
    
     
    
    }

    3、执行测试

  • 相关阅读:
    简单的php socket 实例
    正则表达式语法
    js 固话正则
    php性能剖析的几款软件
    mysql基准测试
    mysql事务
    PHP字符串函数
    Git的使用---4.git的基本使用
    Git的使用---3.git的配置
    Git的使用---2.git的安装
  • 原文地址:https://www.cnblogs.com/alexzhang92/p/10405650.html
Copyright © 2011-2022 走看看