PersonContactController extends BaseController implements CrudController<PersonContactResource, PersonContactResource> { @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/contacts/{id}", method = RequestMethod.PUT) public MessageResource updateResource(@PathVariable("id") final Long id, @Valid @RequestBody final PersonContactResource resource) { LOG.info("Updated person contact with id: {}, {}", id, resource); facade.updateResource(id, resource); return new MessageResource(MessageType.INFO, "PersonContact Updated"); }  @Override @ResponseStatus(HttpStatus.CREATED) @RequestMapping(value = "/{personId}/contacts", method = RequestMethod.POST) PersonContactResource createResource(@Valid @RequestBody final PersonContactResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/contacts/{id}", method = RequestMethod.PUT) MessageResource updateResource(@PathVariable("id") final Long id,
			@Valid @RequestBody final PersonContactResource resource); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/contacts/{id}", method = RequestMethod.GET) PersonContactResource getResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.NO_CONTENT) @RequestMapping(value = "/{personId}/contacts/{id}", method = RequestMethod.DELETE) MessageResource removeResource(@PathVariable("id") final Long id); @Override @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/{personId}/contacts", method = RequestMethod.GET) PagedResultResource<PersonContactResource> getPagedResource(final PagedRequest<PersonContactResource> request);  }
@Test public void testUpdatePersonContact() throws Exception { Long personId = 2L; Long id = 1L; PersonContactResource personContactResource = new PersonContactResource(); personContactResource.setId(id); personContactResource.setPersonId(personId); MessageResource responseResource = new MessageResource( MessageType.INFO, "PersonContact Updated"); String request = getJson(personContactResource, true); String response = getJson(responseResource, false); mockMvc.perform(put("/persons/{personId}/contacts/{contactId}", personId, id) .contentType(MediaType.APPLICATION_JSON) .content(request)) .andExpect(status().isOk()) .andExpect(content().string(response)); verify(facade).updateResource(id, personContactResource); }