我怎么可能在 mockito、spring mvc 环境中为 boolean 编写测试用例
例如,像下面的响应
MockHttpServletResponse:
Status = 200
Error message = null
Headers = {Content-Type=[application/json;charset=UTF-8]}
Content type = application/json;charset=UTF-8
Body = {"name":"myName","DOB":"12345"}
Forwarded URL = null
Redirected URL = null
Cookies = []
我们会像这样编写测试用例,
mockMvc.perform(get("/reqMapping/methodName"))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$.name",comparesEqualTo("myName");
.andExpect(jsonPath("$.DOB",comparesEqualTo("12345");
对?但是,当我们得到如下响应时
MockHttpServletResponse:
Status = 200
Error message = null
Headers = {Content-Type=[application/json;charset=UTF-8]}
Content type = application/json;charset=UTF-8
**Body = true**
Forwarded URL = null
Redirected URL = null
Cookies = []
我应该如何编写测试用例?
mockMvc.perform(get("/reqMapping/methodName"))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(???);