import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

@SpringBootTest
@RunWith(SpringRunner.class)
public class UserAddressTest {
private static final Logger LOG = LoggerFactory.getLogger(UserAddressTest.class);

//@Autowired
//private IUserAddressService addressService;

@Test
public void findAddress() {
// String userCode = "aa3ff3af-7ad2-4957-af6d-8822bd53b026";
// Result result = addressService.selectUserAddress(userCode);
// LOG.info("返回的结果是:{}",result);
// LOG.info("结果数据格式化后是:{}",JSON.toJSONString(result,SerializerFeature.PrettyFormat,SerializerFeature.WriteMapNullValue));
}
}

spring boot 测试类的更多相关文章

  1. spring boot测试类自动注入service或dao

    使用Spring Boot进行单元测试时,发现使用@Autowired注解的类无法自动注入,当使用这个类的实例的时候,报出NullPointerException,即空指针异常. Spring Boo ...

  2. Spring Boot 测试时的日志级别

    1.概览 该教程中,我将向你展示:如何在测试时设置spring boot 日志级别.虽然我们可以在测试通过时忽略日志,但是如果需要诊断失败的测试,选择正确的日志级别是非常重要的. 2.日志级别的重要性 ...

  3. spring boot 启动类一定要放置到包的根目录下,也就是和所有包含java文件的包在同一级目录。如果不放置在根目录下,将会提示 no mybatis mapper was found

    spring boot 启动类一定要放置到包的根目录下,也就是和所有包含java文件的包在同一级目录.将会将同一目录下的包扫描成bean. 如果不放置在根目录下,将会提示 no mybatis map ...

  4. Spring boot 工具类静态属性注入及多环境配置

    由于需要访问MongoDB,但是本地开发环境不能直接连接MongoDB,需要通过SecureCRT使用127.0.0.2本地IP代理.但是程序部署到线上生产环境后,是可以直接访问MongoDB的,因此 ...

  5. Spring Boot(七):spring boot测试介绍

    首先maven要引入spring-boot-starter-test这个包. 先看一段代码 @RunWith(SpringRunner.class) @SpringBootTest(webEnviro ...

  6. spring boot自定义类配置绑定在配置文件中自动提示

    在spring boot的日常使用中,我们可能需要使用配置绑定的方式动态配置自定义类的成员变量. 这个时候,我们在配置文件中配置spring默认已有的配置时,只需要输入部分关键字即可自动提示,如下图: ...

  7. Spring Boot普通类调用bean

    1 在Spring Boot可以扫描的包下 假设我们编写的工具类为SpringUtil. 如果我们编写的SpringUtil在Spring Boot可以扫描的包下或者使用@ComponentScan引 ...

  8. Spring Boot 主类及目录结构介绍

    Spring Boot 与传统项目最大的区别是,传统项目都是打成 WAR 包部署到服务器上面,需要额外的 Servlet 容器, 而 Spring Boot 则可以直接打成 jar 包,并内置集成了 ...

  9. Spring Cloud Ribbon负载均衡配置类放在Spring boot主类同级增加Exclude过滤后报Field config in com.cloud.web.controller.RibbonConfiguration required a bean of type 'com.netflix.client.config.IClientConfig' that could not b

    环境: Spring Cloud:Finchley.M8 Spring Boot:2.0.0.RELEASE 目录结构: 可以看到代码第13行的注释,我已经在@ComponentScan注解中添加了E ...

随机推荐

  1. 异常: java.security.InvalidKeyException: Illegal key size

    今天在做接口测试的时候遇到个异常: java.security.InvalidKeyException: Illegal key size. SecretKeySpec secretKeySpec = ...

  2. 打开Visual Studio 2012的解决方案 连接 Dynamics CRM 2011 的Connect to Dynamics CRM Server 在其工具下没有显示

    一.使用TFS 代码管理,发现Visual Studio 2012 菜单栏 工具下的Connect to Dynamics CRM Server 没有显示. 平常打开VS下的工具都会出现Connect ...

  3. Microsoft Dynamics CRM 4.0导入组织(Import Organization)时间过长的原因总结

    952934    How to move the Microsoft Dynamics CRM 4.0 deployment http://support.microsoft.com/default ...

  4. 日期获取 net

    项目中用到了,所以就写全了,供参考使用. DateTime dt=DateTime.Now;int weeknow = Convert.ToInt32(DateTime.Now.DayOfWeek); ...

  5. 源码|ThreadLocal的实现原理

    ThreadLocal也叫"线程本地变量"."线程局部变量": 其作用域覆盖线程,而不是某个具体任务: 其"自然"的生命周期与线程的生命周期 ...

  6. 关于后台程序java报错问题解决

    HTTP Status – Internal Server Error Type Exception Report Message Handler processing failed; nested ...

  7. spring boot学习(1) hello world

    第一节:SpringBoot 简介 主要是简化开发: 1. 创建独立的Spring应用程序 2. 嵌入的Tomcat,无需部署WAR文件 3. 简化Maven配置 4. 自动配置Spring 5. 提 ...

  8. Bootstrap table的一些简单使用总结

    在GitHub上Bootstrap-table的源码地址是:https://github.com/wenzhixin/bootstrap-table Bootstrap-table的文档地址:http ...

  9. shell 10流程控制

    if 判断 if #shell #!/bin/sh a=5 if [[ $a > 3 ]];then echo "$a>3" fi #写成一行 if [[ $a < ...

  10. MySQL-Jira双机热备

    主服务器:192.168.1.23 从服务器:192.168.1.243 一.主服务器Master配置 1. 创建同步账号.赋权 在主服务器上为从服务器建立一个连接帐户,此处用root,该帐户必须授予 ...