@Test
public void testLogoutFailures() throws Exception {
// PHONE_INVALID_FORMAT
mockMvc.perform(post(URI_USER_LOGOUT)
.param("phoneNum", TEST_PHONE_INVALID)
.session(session))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.*").value(Matchers.hasSize(2)))
.andExpect(jsonPath("$.info").isString())
.andExpect(jsonPath("$.code").value(100));
// SESSION_NOT_FOUND
mockMvc.perform(post(URI_USER_LOGOUT)
.param("phoneNum", TEST_PHONE_USER))
.andExpect(status().isForbidden())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.*").value(Matchers.hasSize(2)))
.andExpect(jsonPath("$.info").isString())
.andExpect(jsonPath("$.code").value(403));
}
UserControllerTest.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:ServiceServer
作者:
评论列表
文章目录