### Question:
PersonController { @RequestMapping(value="/{id}", method=RequestMethod.PUT) public Person updatePerson(@PathVariable(value="id")String id, @RequestBody Person person){ if(null == id || !id.equals(person.getId())){ throw new RequestConflictException("Id doesn't match model id"); } return this.personRepository.save(person); }  @RequestMapping(method=RequestMethod.GET) Person findPerson(@RequestParam(value = "displayName")String displayName); @RequestMapping(method = RequestMethod.POST) Person addPerson(@RequestBody final Person model, HttpServletRequest request, HttpServletResponse response); @RequestMapping(value = "/{id}", method = RequestMethod.GET) Person getPerson(@PathVariable(value="id")String id); @RequestMapping(value="/{id}", method=RequestMethod.PUT) Person updatePerson(@PathVariable(value="id")String id, @RequestBody Person person); @RequestMapping(value="/{id}", method=RequestMethod.DELETE) void deletePerson(@PathVariable(value="id")String id);  }### Answer:
@Test public void testUpdatePerson() throws Exception { ObjectMapper mapper = new ObjectMapper(); person.setDisplayName("newJunitTestPerson"); String jsonValue = mapper.writeValueAsString(person); mockMvc.perform(put("/persons/" + personId).accept(MediaType.parseMediaType("application/json;charset=UTF-8")) .contentType(MediaType.parseMediaType("application/json;charset=UTF-8")).content(jsonValue)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))); }