草庐IT

java - 如何使用 mockMvc 检查响应正文中的字符串

我有简单的集成测试@TestpublicvoidshouldReturnErrorMessageToAdminWhenCreatingUserWithUsedUserName()throwsException{mockMvc.perform(post("/api/users").header("Authorization",base64ForTestUser).contentType(MediaType.APPLICATION_JSON).content("{\"userName\":\"testUserDetails\",\"firstName\":\"xxx\",\"lastNam