jeudi 25 décembre 2014

Spring's MockMvc perform patch

How can I perform patch with Spring's MockMvc? I tried with following code:



@Test
public void should_patch_success() throws Exception{
mockMvc.perform(
request(HttpMethod.PATCH, "/Some/1")
.content(convertObjectToJson(new User()))
.contentType(MediaType
.parseMediaType("application/json;charset=UTF-8")))
.andExpect(status().isOk());
}


I'm sure that method convertObjectToJson works and MediaType is set correctly but it returns:



org.mockito.exceptions.misusing.InvalidUseOfMatchersException:
Invalid use of argument matchers!
2 matchers expected, 1 recorded.

Aucun commentaire:

Enregistrer un commentaire