当前位置: 首页 > news >正文

Spring boot 集成单元测试

1.引入依赖

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency>

2.

 3.编写测试类

package com.enterprise;import com.enterprise.entities.Company;
import com.enterprise.feignclient.IFeignCompanyService;
import com.enterprise.policy.service.PublishPolicyService;
import org.apache.commons.lang.StringUtils;
import org.junit.Assert;
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.SpringRunner;import java.util.HashMap;
import java.util.List;
import java.util.Map;@SpringBootTest
@RunWith(SpringRunner.class)
public class SpringBootTest01 {@Autowiredprivate PublishPolicyService publishPolicyService;@Autowiredprivate IFeignCompanyService companyService;@Testpublic void findOne() throws Exception {Map<String,String> rmap=new HashMap<>();rmap.put("companySize","SMALL_ENTERPRISE");rmap.put("companyPeriod","MEDIUM_PERIOD");rmap.put("companyAttribute","INDIVIDUAL_BUSINESS");List<Company> list =companyService.screenCompanyByPolicy(rmap);System.out.println(list);}
}

http://www.lryc.cn/news/141909.html

相关文章:

  • 基于C++的QT实现贪吃蛇小游戏
  • Spring Boot整合RabbitMQ之路由模式(Direct)
  • 行式存储与列式存储
  • windows上sqlserver的ldf日志文件和数据mdf文件分别放到不同的磁盘
  • vue3+uni——watch监听props中的数据(组件参数接收与传递defineProps、defineEmits)
  • mybatis与spring集成与spring aop集成pagehelper插件
  • Mybatis基础
  • TypeScript-- 配置Typescript环境(1)ts 转js,tsc --watch 实时编译
  • Dockerfile快速搭建自己专属的LAMP环境,生成镜像lamp:v1.1,并推送到私有仓库
  • Lottery抽奖项目学习第二章第一节:环境、配置、规范
  • OpenCV之reshape函数
  • 【JavaEE】Spring事务-@Transactional参数介绍-事务的隔离级别以及传播机制
  • 微信小程序canvas type=2d生成海报保存到相册、文字换行溢出显示...、文字删除线、分享面板
  • C++卷积神经网络
  • go 读取yaml映射到struct
  • Redis 10 大数据类型
  • 优化生产流程:数字化工厂中的OPC UA分布式IO模块应用
  • Elasticsearch(十四)搜索---搜索匹配功能⑤--全文搜索
  • 已解决Gradle错误:“Unable to load class ‘org.gradle.api.plugins.MavenPlugin‘”
  • windows中安装sqlite
  • 前端面试:【系统设计与架构】前端架构模式的演进
  • 【CSS】em单位的理解
  • 无涯教程-Python机器学习 - Based on human supervision函数
  • 【滑动窗口】leetcode209:长度最小的子数组
  • C++ STL unordered_map
  • 全流程R语言Meta分析核心技术应用
  • Go并发可视化解释 - Select语句
  • 在线SM4(国密)加密解密工具
  • golang的类型断言语法
  • 提速换挡 | 至真科技用技术打破业务壁垒,助力出海破局增长