@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class,webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class TestUserController {
@Autowired
private TestRestTemplate restTemplate;
@Test
public void get() throws Exception {
MultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
map.add("phone", "xxx");
String result = restTemplate.postForObject("/my/sendCode", map, String.class);
System.out.println(result);
}
}
【SpringBoot】单元测试
最新推荐文章于 2024-07-11 10:00:42 发布