I am currently working on the unit testing of my controller, the content type should be Multipart_Form_Data. However when I am trying to run it, the body that it is returning is empty.
mockMvc.perform(post(path)
.content(objectMapper.writeValueAsString(request))
.servletPath(path)
.headers(headers)
.contentType(MediaType.MULTIPART_FORM_DATA)
.accept(MediaType.MULTIPART_FORM_DATA))
.andExpect(status().isBadRequest())
.andDo(print())
.andReturn();
Response:
MockHttpServletResponse:
Status = 400
Error message = null
Headers = []
Content type = null
Body =
Forwarded URL = null
Redirected URL = null Cookies = []
Aucun commentaire:
Enregistrer un commentaire