Does anybody have any tips, or does anybody know how I can test the \"error message\" returned by the HTTP response object?
@Autowired private WebApplicationCont
Even simpler:
String error = mockMvc... .andExpect(status().isUnauthorized()) .andReturn().getResolvedException().getMessage(); assertTrue(StringUtils.contains(error, "Bad credentials"));