### Question:
PersonController { @RequestMapping(method = RequestMethod.POST) public Person addPerson(@RequestBody final Person model, HttpServletRequest request, HttpServletResponse response){ model.setId(UUID.randomUUID().toString()); Person person = this.personRepository.save(model); if(null != person){ String location = request.getRequestURI().toString() + FORWARD_SLASH + person.getId(); response.addHeader("Location", location); response.setStatus(201); } return 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 testAddPerson() throws Exception { ObjectMapper mapper = new ObjectMapper(); Person tempPerson = new Person(); tempPerson.setDisplayName("junittest"); String jsonValue = mapper.writeValueAsString(tempPerson); mockMvc.perform(post("/persons").accept(MediaType.parseMediaType("application/json;charset=UTF-8")) .contentType(MediaType.parseMediaType("application/json;charset=UTF-8")).content(jsonValue)) .andExpect(status().isCreated()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))); }