标题
spring boot 单元测试
1.pom文件中引入相关依赖
<!-- 引入单元测试依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
2.创建测试类
@SpringBootTest(classes = DataServicesApplication.class)
@RunWith(SpringRunner.class)
public class Testtr {
@Autowired
private TimerService timerService;
@Test
public void sss(){
System.out.println(123);
ConditionResult c = new ConditionResult();
c.setStartTime("2019-12-01");
c.setEndTime("2019-12-01");
timerService.generateData(c);
}
}