0


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 {
    @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);
    }
}

本文转载自: https://blog.csdn.net/qq_31683775/article/details/132514166
版权归原作者 qq_31683775 所有, 如有侵权,请联系我们删除。

“Spring boot 集成单元测试”的评论:

还没有评论