单元测试
前言
Spring boot 提供一系列测试工具集及注释方便我们进行测试
spring-boot-test提供核心测试能力,spring-boot-test-autoconfigure 提供测试的一些自动化配置
我们只需导入spring-boot-starter-test即可整合测试
1、写测试要用的类
package com.example.boot306demo.service;
import org.springframework.stereotype.Service;
/**
* @author jitwxs
* @date 2023年11月15日 20:27
*/
@Service
public class HelloService {
public int sum(int a,int b){
return a+b;
}
}