【SpringBoot】单元测试
@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);
}
}
网络上志同道合,我们一起学习网络安全,一起进步,QQ群:694839022