对于测试类使用的
@SpringBootTest
@RunWith(SpringRunner.class)
public class DaoTest {
@Autowired
private UserDao userDao;
@Test
public void test1(){
User user = new User();
user.setId(1l);
user.setItemId(1L);
user.setOpenId("1");
userDao.save(user);
}
}
标签:依赖,spring,boot,springframework,user,测试,test,注解,junit From: https://www.cnblogs.com/jiangzishun/p/17727664.html
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.3.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
</dependency>