get
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get("")
.headers(new HttpHeaders())
.contentType(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().isOk())
.andReturn();
String contentAsString = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
post
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("")
.headers(new HttpHeaders())
.content("")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().isOk())
.andReturn();
String contentAsString = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|