写个一个UserServicetest放在test包中
UserserviceTest:
package com.itheima.test;
import org.apache.catalina.User;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SpringbootTestApplication.class)
public class UserServiceTest {
@Autowired
private UserService userService;
@Test
public void testAdd(){
userService.add();
}
}
目录:
其中RunWith报错,尝试了网上的方法,修改了配置文件pom
但还是报错,请问怎么解决呢?