SpringBoot整合Junit测试
1、添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
2、编写测试类
@RunWith(SpringRunner.class)
@SpringBootTest
public class MulQuery {
@Autowired
private OneToOne oneToOne;
@Autowired
private AccountDao accountDao;
@Test
public void testOneToMore(){
System.out.println(oneToOne.findUserlnfo(1));
}
@Test
public void testAccount(){
System.out.println(accountDao.findById(1));
}
}