在使用Junit做测试的时候,有时候需要调用Http通信,无论是request还是response或者是session会话,那么在测试类里该如何调用呢,其实很简单,spring给我们提供了三个类
org.springframework.mock.web.MockHttpServletRequest,org.springframework.mock.web.MockHttpServletResponse,org.springframework.mock.web.MockHttpSession
使用如下:
@Autowired
???MockHttpServletRequest request;
@Autowired
???MockHttpServletResponse response;
@Autowired
???MockHttpSession session; ?
Junit测试类中如何调用Http通信
原文地址:http://www.cnblogs.com/zhangdiIT/p/7818463.html