0
点赞
收藏
分享

微信扫一扫

Spring boot 集成单元测试

扒皮狼 2023-09-02 阅读 8

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 {
@Autowired
private PublishPolicyService publishPolicyService;
@Autowired
private IFeignCompanyService companyService;
@Test
public 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);
}
}
举报

相关推荐

0 条评论